JavaScript onunload not working as expected in IE10
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: onunload not working as expected in IE10

  1. #1
    Join Date
    Sep 2013
    Posts
    1

    onunload not working as expected in IE10

    I am facing a strange problem in my environment, let me explain it. I have a HTML page as shown below -

    Code:
    <!DOCTYPE html>
    <html>
       <head>
          <script type="text/javascript>
             window.onunload=function(){alert("unloading page");}
          </script>
       </head>
       <body>
          <a href="http://localhost:8080/ABC">Localhost</a>
       </body>
    </html>
    When I am opening this page in IE10 and clicking on Localhost link, I can't see an alert "unloading page". However, in IE7, it's working fine. However if I use "http://google.co.in/ " instead, it's working in both IE10 and IE7.

    Can anyone please resolve this issue? Thanks in advance.
    Last edited by PeejAvery; September 27th, 2013 at 08:50 PM. Reason: Added code tags

  2. #2
    PeejAvery's Avatar
    PeejAvery is offline Super Moderator Power Poster
    Join Date
    May 2002
    Posts
    10,868

    Re: onunload not working as expected in IE10

    That's because IE10 is finally increasing it's security. Allowing execution of code at page leave is a huge cause of intrusive code.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center