创建一个1.html代码如下

<a/ onclick="jump()">2222222222222</a>

<script/>
    function jump(){
        window.location.replace('./2.html')
    }
    
</script>

 

再在同目录下创建一个空的2.html

用浏览器打开1.html点击跳转会发现无法返回上一页 测试用浏览器为chrome

 

window.location.assign(url) :

 加载 URL 指定的新的 HTML 文档。 就相当于一个链接,跳转到指定的url,当前页面会转为新页面内容,可以点击后退返回上一个页面。

posted on 2019-07-12 16:34  头皮发麻  阅读(882)  评论(0编辑  收藏  举报