http://www.runoob.com/jsref/e...
After hooking up.
Refresh it again
The function body will not be triggered at all.
I tested it. Why is this?
Just leave it unchecked
window.addEventListener("beforeunload", function(event) {
alert("弹出");
sessionStorage.name="你的名字"; //请教一下为什么这个sessionStorage都能存下来?而alert没弹出来?这是什么机制啊?
});
http://jsbin.com/zisazacani/e... JS Bin online example
Thanks for the invitation
Official documentation explains
In addition, this is for security reasons and does not allow disabling system pop-ups.