IE7: onbeforeunload broken with javascript links

Discussion in 'Internet Explorer' started by Alexander Zink, Aug 12, 2006.

  1. In IE6 (just like in Firefox), the onbeforeunload event is fired when the
    user chosses to leave the page, either via navigation commands (back, reload,
    new url, ...) or by clicking on a link carrying e.g. an http url.
    However, onbeforeunload in NOT fired if the user clicks on a 'javascript:'
    url link.

    Now in IE 7, 'javascript:' links also fire the onbeforeunload event -
    independent from the actual command written in the javascript code!

    As a result, all our internal check and edit functions within a local
    application page now bother the IE 7 user on every click whether he really
    wants to leave the page - even through there is no page change issued at all
    as part of the javascript code...

    For 'javascript:' links, the onbeforeunload event should be fired (just like
    in IE6) only on particular javascript commands like history manipulation
    (which may or may not appear as part of the 'javascript:' link), but no just
    based on the 'javascript:' protocol type itself.
    Alexander Zink, Aug 12, 2006
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.