2012-06-22 64 views
0

当应用程序将在Internet Explorer中关闭时,我使用以下事件来调用。它的工作很好,这意味着它将调用当我关闭IE浏览器Tab.And 我的问题是如果我关闭窗口我收到来自网页的消息,我收到带有该消息的'False'语句。如果我删除了此函数中的返回false语句,我没有 访问该函数。如何从Msg Box中隐藏False语句? enter image description hereIE中的onbeforeunload事件消息错误?

window.onbeforeunload = function(event) 
{ 

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

}  

回答

0

试试这个:

window.onbeforeunload = function(event) 
{ 

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

} 
0

试试这个:

返回Cusom消息,而不是假

window.onbeforeunload = function(event) 
{ 
return "Are you sure ";  
}  
+0

如果我用这个,我会得到[对象],而不是假 – User

+0

@user具有u尝试 – Vinod

0

在所有主要的网络浏览器,也无法取消一个 '导航离去' 更高版本。您唯一能做的就是向用户提供一条消息。由于互联网的初期大肆滥用这一功能

window.onbeforeunload = function() {return "your message goes here";} 

“确定”和“取消”按钮以及周围的文本是由浏览器来控制:这是通过返回一个字符串来完成。甚至不要依赖您显示的自定义消息。例如,Firefox简单地说,该页面试图阻止您导航,但不会显示您的自定义消息。