這個問題是最近遇到的
解決方案我百度的并測試有效
// 如果你希望用戶不用有返回功能 可縮寫如下 或使用location.replace('url')跳轉鏈接history.pushState(null, null, document.URL);window.addEventListener('popstate', function () { history.pushState(null, null, document.URL);});
注:上面的代碼是禁止頁面返回,其中document.URL可以指定頁面的鏈接來跳轉。
<script>// 如果你希望用戶不用有返回功能 可縮寫如下 或使用location.replace('url')跳轉鏈接 history.pushState(null, null, document.URL);window.addEventListener('popstate', function () { history.pushState(null, null, location.replace('http://www.companysz.com'));});</script>
|
新聞熱點
疑難解答