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 2 of 2
  1. #1
    eli
    eli is offline
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    control in closing window

    How can I put an alert when the user is trying to close the window?
    I tried with onUnload, but the window is closed before the function associated is called.
    Any idea?

  • #2
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Code:
    <body onunload="alert('You are closing this window');">
    The onunload event is often disabled by various browsing softwares/plugins such as popup blockers due to abuse over the years. I would suggest using a different strategy to do whatever it is you are trying. As a general rule if there's onunload popups on a website, I do not return

    m_n
    Last edited by martin_narg; 07-11-2005 at 05:28 PM.
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper


  •  

    Posting Permissions

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