Reputation: 29
This is my javascript function and I want to redirect to another page on success of this event so how can I do it?
window.onbeforeunload = function (e) {
e = e || window.event;
// For IE and Firefox prior to version 4
if (e) {
e.returnValue = 'Sure you want to go back?';
}
// For Safari
return 'Sure you want to go back?';
};
Upvotes: 0
Views: 176
Reputation: 1359
Did you tried this
window.location.href = 'http://redirecttourl.com'
Upvotes: 1
Reputation: 905
Just change your location :
window.location = 'http://stackoverflow.com';
Upvotes: 1