StealthRT
StealthRT

Reputation: 10552

Redirecting and getting "Leaving this page" alert box

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

enter image description here

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.

Upvotes: 0

Views: 1908

Answers (1)

A. Wolff
A. Wolff

Reputation: 74420

Wait, do you mean:

window.onbeforeunload = null;

Upvotes: 3

Related Questions