简单的关闭自己写的页面
可以用(1)
window.onload = function(){
alert("欢迎进入");
window.onbeforeunload = function(){
return 000;
//因为关闭了之后看不到
// alert("确定关闭");
}
}
(2)
window.addEventListener('beforeunload',function(e){
console.log('000');
e.preventDefault()
e.returnValue='确定关闭'
})
//前提页面有操作才会出现