当用户关闭IE时显示一个消息框 [英] show a message box when user close IE

查看:102
本文介绍了当用户关闭IE时显示一个消息框的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何javascript在用户关闭IE时提示消息框?我试图找到一段代码示例一段时间,但失败了。



提前感谢
George



这是我的html代码,但它有以下错误。任何想法?



为了帮助保护您的安全,Internet Explorer已将此网页限制在运行可访问您的计算机的脚本或ActiveX控件。点击这里查看选项...

解决方案

您正在寻找 beforeunload 事件



例如:

  function someCloseEvent(){
return任何字符串值都会强制在关闭窗口之前出现一个对\\\\
对话框。
}

window.onbeforeunload = someCloseEvent;


Any javascript to prompt a message box when a user closes IE? I have tried to find a code sample for quite a while but failed.

thanks in advance, George

Here is my html code, but it has the following error. Any ideas?

To help protect your security, Internet Explorer has restricted this webpage from running scripts or ActiveX controls that could access your computer. Click here for options...

解决方案

You are looking for the beforeunload event.

For example:

function someCloseEvent() {
  return "Any string value here forces a dialog box to \n" +
         "appear before closing the window.";
}

window.onbeforeunload = someCloseEvent;

这篇关于当用户关闭IE时显示一个消息框的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆