SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Post Confirm Browser Closing in Netscape

    Is there an equivalent to the IE onBeforeUnLoad() event for Netscape? I have tried onUnload() but that does not seem to work when the window is closed using the [X] (upper right hand close button), only when the page is refreshed or the user navigates away from the page.

    What I want to accomplish is to ask a user if they are sure they want to close the window. If they say OK then close it, otherwise dont close it. Any suggestions?

  2. #2
    morphine for a wooden leg randem's Avatar
    Join Date
    Jun 2002
    Location
    .chicago.il.us
    Posts
    957
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    One of the many reasons why Netscape/Mozilla is my favorite browser is because developers aren't able to hijack the browser the way IE allows you to.

    I don't believe there is any event you can use to accomplish what you are attempting. But rather than find that disappointing, perhaps you should consider that there are people like myself who prefer not to get attacked by JavaScripts which question our intelligence when we press the [X] in attempt to close the window.

    ...of course i want to close the window. I hit the close button, didn't I? ...

    Just my opinion...

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2001
    Posts
    44
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks for the reply. I agree that it is not the best practice to "attack" someone with a javascript, but in this particular instance the application requires it. The client specifically demanded it, so it is a necessary evil.

    ....I closed the window by mistake and now I have to start over.

    Thanks again for the response.

  4. #4
    SitePoint Member
    Join Date
    Jun 2002
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    So, what I do is that I have an onFocus event that checks whether the remote window is closed and if it is I set the cookie. When the user closes the remote window focus is given back to the main window, thereby triggering the onFocus event. Simple, yet effective.
    That's all I could really find in terms of solutions but it doesn't seem like what you need.
    -dk
    - Confused? Have another drink.


Bookmarks

Posting Permissions

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