You must Sign In to post a response.
  • Category: JavaScript

    Onbeforeunload and post back problem

    On before unload and post back in JavaScript's are not working correctly...
    I need onbefore unload to fire only for browser/tab close. But in some situations for other events also getting called. Please help me to solve this
  • #756413
    This is the default behavior this event fires whenever the user leaves your page for any reason.. it will be fired if the user submits a form, clicks a link, closes the window (or tab), or goes to a new page using the address bar, search box, or a bookmark.


    $(window).bind("beforeunload", function() {
    return inFormOrLink ? "Do you really want to close?" : null;
    })

    Thanks & Regards
    Anil Kumar Pandey
    Microsoft MVP, DNS MVM


  • Sign In to post your comments