After adding this short js code:
$(document).ready(function() {
//check to see if it's an external link and if so do the splashpage
$('a').click(function() {
var $this = $(this);
//get the redirect url
var redirect_url = $this.attr('href');
var string_url = String(redirect_url);
if (string_url.indexOf("http") !== -1) {
$('#external_link_modal').modal({
overlayClose: true,
overlayCss: {
backgroundColor: "#ebebeb"
}
});
setTimeout(function() {
window.location.replace(string_url);
}, 2500);
return false;
}
});
});
When someone clicks on a link (say on Page A) it pops up a warning then after some time, redirect the user to the new url (say Page B).
However, when someone clicks the browser’s ‘Back’ button on page B, instead of taking user to Page A like it’s supposed to, it actually takes him to the page viewed before Page A.
It’s really weird.
Does anyone have any idea why?
Thanks beforehand!
window.location.replace(string_url)replaces the current history entry withstring_url. You should setwindow.location.hrefinstead: