how to detach event : onbeforeunload or onunload? RRS feed

  • Question

  • Hello 

    i have tried add follow code to form onLoad event. but it doesn't work. 

    removeUnloadevent = function() {
        window.onbeforeunload = function() { }
        window.onunload = function() { }
      window.detachEvent("onbeforeunload", PromptAndReportAnyErrors);

    when you refresh or close page(tab), there is still warnning message:



    Are you sure you want to leave this page?

    Your changes have not been saved. To stay on the page so that you can save your changes...



    my questions is how to detach or remove such event?

    Thanks in advance.

    Friday, February 25, 2011 4:15 AM


All replies