我编写了以下代码来清除浏览器历史记录,它在Internet Explorer中正常工作,但它在Mozilla Firefox中不起作用.我怎么解决这个问题?
<script language="JavaScript">
function DisablingBackFunctionality()
{
var URL;
var i ;
var QryStrValue;
URL=window.location.href ;
i=URL.indexOf("?");
QryStrValue=URL.substring(i+1);
if (QryStrValue!='X')
{
window.location.href="http://localhost:8085/FruitShop/";
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
我正在编写这段代码<header>.
您的代码也可以大大简化 - 但要注意它不会清除历史记录.您无法清除历史记录,只保留页面进入历史记录或在尝试时打破后退按钮
function DisablingBackFunctionality() {
// get the query string including ?
var passed =window.location.search;
// did we receive ?X
if (passed && passed.substring(1) =="X") {
// if so, replace the page in the browser (overwriting this page in the history)
window.location.replace("http://localhost:8085/FruitShop/");
}
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18283 次 |
| 最近记录: |