0
如果用戶點擊onbeforeunload時留下頁面按鈕,我該如何重定向他。請檢查我的代碼重定向到其他頁面如果點擊離開頁面
function openNewWindow() {
window.open('http://google.com/','_blank');
window.focus();
}
window.onbeforeunload = function(event) {
event = event || window.event;
var confirmClose = 'Are you sure?';
if (event) {
event.returnValue = confirmClose;
if(confirmClose)
{
if(true)
{
openNewWindow();
}
}
return confirmClose;
}
}
感謝