problem with close button in IE7 browser

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • smilyswapna10
    New Member
    • Feb 2008
    • 1

    problem with close button in IE7 browser

    hi,

    I am working on the IE7 browser.

    when click on the close(X) button i need a conformation same as i open the multiple tabs in a single browser and while i closing the tabs also i need a conformation and same as if close the tab from the status bar also i need a conformation.

    I have written the code like this.

    [CODE=javascript]<script language="javas cript">


    window.onbefore unload = function()
    {
    this.focus();
    alert('close');
    }
    <script>[/CODE]

    But this code is not working fine.

    when i click the refresh and home icon in the browser it is getting the conformation i don't want conformation.

    Thanks
    Last edited by gits; Feb 26 '08, 12:56 PM. Reason: added code tags
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    onbeforeunload fires before unloading (which includes closing, refreshing, pressing forward/back). There's no specific event for window close, though you could try one or two workarounds depending on your application.

    Comment

    Working...