简体   繁体   中英

Redirecting and getting “Leaving this page” alert box

Is it possible to suppress the "Leave this page" alert when redirecting to another page?

在此处输入图片说明

I am using the jQuery notification popup Apprise v2 and once i click on the "OK" button on the popup box this is the code i execute:

if (window.location.protocol != "https:") {
    //window.location.href ="https://" + location.hostname + '/thank-you';
    window.location.replace("https://" + location.hostname + '/thank-you');                                                 
} else {            
    //window.location.href ='/thank-you';
    window.location.replace("/thank-you");
}

As you see above, I've tried both window.location.href and window.location.replace but they give the same alert box it seems.

等等,你的意思是:

window.onbeforeunload = null;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM