没想到啊

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
  6 随笔 :: 379 文章 :: 97 评论 :: 24万 阅读
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5
复制代码
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
</head>
<body>
检测浏览器关闭,同时屏蔽F5
listen browser colse event and disable F5,
</body>
</html>
<script type="text/javascript">
<!--
window.onbeforeunload
= onbeforeunload_handler;
window.onunload
= onunload_handler;
document.onkeydown
= disableF5;
function onbeforeunload_handler(){
if(1==1){
var warning="Close this window?";
return warning;
}

}
function onunload_handler(){


}
function disableF5(e)
{

if (!e)
{
var e = window.event;
}
var keycode = e.keyCode;
if (e.which)
keycode
= e.which;

var src = e.srcElement;
if (e.target)
{
src
= e.target;
}
// 116 = F5
if (116== keycode)
{
// Firefox and other non IE browsers
if (e.preventDefault)
{
e.preventDefault();
e.stopPropagation();
}
// Internet Explorer
elseif (e.keyCode)
{
e.keyCode
=0;
e.returnValue
=false;
e.cancelBubble
=true;
}

returnfalse;
}
}

-->
</script>
复制代码

 

IE6 不行 :(

posted on   没想到啊  阅读(698)  评论(1编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· 展开说说关于C#中ORM框架的用法!
· SQL Server 2025 AI相关能力初探
· Pantheons:用 TypeScript 打造主流大模型对话的一站式集成库
点击右上角即可分享
微信分享提示