CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2001
    Location
    Michigan
    Posts
    2,222

    javascript/chrome onunload issue

    Code:
    	var win = window.open(page,'window','width=270, height=155, left=300, top=200');
        
            alert('1');
            win.onunload = function() 
            {         
                alert('2');            
            }
    Consider the above code:


    In firefox, I see the new window popup, get a '1' alert, then close the popup window, then see the '2' alert.

    In chrome, I see the new window popup, get a '1' alert, then additionally get the '2' alert immediately following the '1'.
    When I close the chrome window I get no alerts.

    What is the reason for this and how can I resolve this issue?

  2. #2
    Join Date
    May 2002
    Posts
    10,943

    Re: javascript/chrome onunload issue

    Remember that they have two separate JavaScript engines. In my version of Firefox, the second alert does not fire. What version of Firefox are you running?
    Last edited by PeejAvery; August 20th, 2009 at 05:15 PM.
    If the post was helpful...Rate it! Remember to use [code] or [php] tags.

Posting Permissions

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





Click Here to Expand Forum to Full Width

Featured