2024-10-31 07:51:33
window.close();
<script language="javascript" type="text/javascript">
//关闭所有窗口就是关闭浏览器
function closeWindow()
{
var ua=navigator.userAgent
var ie=navigator.appName=="Microsoft Internet Explorer"?true:false
if(ie)
{
var IEversion=parseFloat(ua.substring(ua.indexOf("MSIE ")+5,ua.indexOf(";",ua.indexOf("MSIE "))))
if(IEversion< 5.5)
{
var str = '<object id=noTipClose classid="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11">'
str += '<param name="Command" value="Close"></object>';
document.body.insertAdjacentHTML("beforeEnd", str);
document.all.noTipClose.Click();
}
else
{
parent.window.opener =null;
parent.window.open('','_self','');//for IE7
parent.window.close();
}
}
else
{
parent.window.close()
}
}
//清楚所有cookie
function clearCookie(){
var keys=document.cookie.match(/[^ =;]+(?=\=)/g);
if (keys) {
for (var i = keys.length; i--;)
document.cookie=keys[i]+'=0;expires=' + new Date( 0).toUTCString()
}
}
</script>
<input type="button" value="Close the Window" onclick="closeWindow()" />
2024-10-31 07:51:31
<script type="text/javascript">
window.onbeforeunload = function(e) {
e = e || window.event;
var msg = "您确定要离开此页面吗?";
// IE
e.cancelBubble = true;
e.returnValue = msg;
// Firefox
if(e.stopPropagation) {
e.stopPropagation();
e.preventDefault();
}
// Chrome / Safari
return msg;
};
</script>
把msg 改成你的逻辑就行了
2024-10-31 07:57:42
2024-10-31 07:55:47