window.location.assign和window.location.href区别

window.location.assign和window.location.href区别

window.location.assign(url)和window.location.href=url实现功能是一样的,都是跳转到网址,只是用法稍微不同。

最大的不同是,assign会添加记录到浏览历史,点击后退可以返回之前页面。

They simply navigate to the new URL. The replace method on the other hand navigates to the URL without adding a new record to the history.

So, what you have read in those many forms is not correct. The assign method does add a new record to the history.

原文地址:https://www.cnblogs.com/apache-x/p/5363230.html