2013-10-17 38 views

回答

2

我刚刚使用了windows.location.replace(newUrl),它从历史记录中删除了页面并进行修复。

0

您可以检查引用者并在加载页面上匹配。如果引荐来源是加载页面之后的页面,则可以假定用户按下了。

你可以在JS做到这一点的服务器上或在JavaScript中,例如(伪):

if (document.referrer.test(/[URL]/)) { 
    window.location = '/'; 
} 
+0

感谢您的帮助。 在ie8上,当我按回来按钮它告诉我,referrer是第一页 –

-2

使用JavaScript

Response.Cache.SetNoStore();或window.history.forward(1);

这将禁用后退按钮功能。还有一些会话值,在后退按钮点击的情况下会被设置为空。像下面一样。

<% 
    Response.Buffer = True 
    Response.ExpiresAbsolute = Now() - 1 
    Response.Expires = 0 
    Response.CacheControl = "no-cache" 

    If Len(Session("FirstTimeToPage")) > 0 then 
    'The user has come back to this page after having visited 
    'it... wipe out the session variable and redirect them back 
    'to the login page 
    Session("FirstTimeToPage") = "" 
    Response.Redirect "/Bar.asp" 
    Response.End 
    End If 
%> 
+0

看起来像Visual Basic对我... – Xogle