Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    New Coder
    Join Date
    Apr 2009
    Location
    Ahmedabad,India
    Posts
    54
    Thanks
    4
    Thanked 0 Times in 0 Posts

    Question Open Pop-Up On Browser Close?

    Hi,

    I have used below javascript function in body tag unload event...

    <body onunload="openpopup();">
    </body>

    function openpopup()
    {
    Window.open('popupwin.asp','popUp','scrollbars=no,resizable=no,height=300,width=300');
    }

    Problem :
    When i am refreshing the page Or click any link on page this pop up open....i want to open pop-up only when some one close the page..


    How can i detect browser close event?
    I am using classic ASP...
    can any one help me in this?

    thanks,
    jaymin

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,892
    Thanks
    202
    Thanked 2,528 Times in 2,506 Posts
    It is not possible using Javascript to detect a browser close event as compared with a page change or refresh. In any case, what about people with Javascript disabled?




    Quizmaster: Which African country gives its name to the complaint known as 'gippy tummy'?
    Contestant: Venezuela.

  • #3
    Regular Coder Amphiluke's Avatar
    Join Date
    Jul 2009
    Posts
    312
    Thanks
    3
    Thanked 89 Times in 89 Posts
    The window object has an onclose event, but it seems to be not supported by any browser until now.
    I am still learning English

  • #4
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,892
    Thanks
    202
    Thanked 2,528 Times in 2,506 Posts
    Quote Originally Posted by Amphiluke View Post
    The window object has an onclose event, but it seems to be not supported by any browser until now.
    Well ,that makes it particularly useful!

  • #5
    Regular Coder Amphiluke's Avatar
    Join Date
    Jul 2009
    Posts
    312
    Thanks
    3
    Thanked 89 Times in 89 Posts
    Such a reference must be of interest to the author of the topic. (See example at the bottom of that page.)
    I am still learning English

  • #6
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    Location
    London, England
    Posts
    17,892
    Thanks
    202
    Thanked 2,528 Times in 2,506 Posts
    To be pedantic, onclose is not an event, it is an event handler. The respective event would be named close. However, there is no such event in W3C DOM Level 2 Events (or the Working Group Note on DOM Level 3 Events),

  • #7
    Senior Coder A1ien51's Avatar
    Join Date
    Jun 2002
    Location
    Between DC and Baltimore In a Cave
    Posts
    2,717
    Thanks
    1
    Thanked 94 Times in 88 Posts
    Sad thing is pop up blockers will block it so no one will see it anyway. We are not living in 1999 anymore.

    Eric
    Tech Author [Ajax In Action, JavaScript: Visual Blueprint]

  • #8
    New Coder
    Join Date
    Apr 2009
    Location
    Ahmedabad,India
    Posts
    54
    Thanks
    4
    Thanked 0 Times in 0 Posts
    Thank you all for help.
    i am working on this....


  •  

    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
    •