【发布时间】:2010-12-06 22:52:29
【问题描述】:
添加这段简短的js代码后:
$(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;
}
});
});
当有人点击一个链接(比如页面 A)时,它会弹出一个警告,然后在一段时间后将用户重定向到新的 url(比如页面 B)。
但是,当有人在页面 B 上单击浏览器的“返回”按钮时,它并没有像预期那样将用户带到页面 A,而是将用户带到之前页面 A 浏览过的页面。
真的很奇怪。 有人知道为什么吗?
先谢谢了!
【问题讨论】:
-
这里没有 JS 专家,但这是使用索引值与非索引值的问题吗?
标签: javascript browser back-button