javascript window close event confirm
當瀏覽器關閉的時會先呼叫,不會直接關閉。
window.onbeforeunload = function (e) {
e = e || window.event;
// For IE and Firefox prior to version 4
if (e) {
e.returnValue = 'Any string';
}
// For Safari
return 'Any string';
};
Here is a working jsFiddle
window.onbeforeunload = function (e) {
e = e || window.event;
// For IE and Firefox prior to version 4
if (e) {
e.returnValue = 'Any string';
}
// For Safari
return 'Any string';
};
Here is a working jsFiddle
留言
張貼留言