Search code examples
jqueryinternet-exploreronbeforeunload

onbeforeunload event message error in IE?


I use the following event to call when the application will close in Internet Explorer.It was work Fine that means it will call when i close IE browser Tab.And My problem is if I close the window I receive the message from Webpage,I receive the 'False' statement with that message.If I remove the return false statement in this function I didn't access the function.How to hide the False statement from the Msg Box? enter image description here

window.onbeforeunload = function(event) 
{

           if($.browser.msie)
           {
               alert('Test');
               return false;
            }

 }    

Solution

  • Try this:

    window.onbeforeunload = function(event) 
    {
    
               if($.browser.msie)
               {
                   alert('Test');
                   return "";
                }
    
     }