Window location.assign()
描述
assign() 方法加载一个新文档。
另请参阅
注意
assign() 和 replace() 的区别
replace() 从文档历史中移除当前 URL。
使用 replace() 时,无法使用“后退”按钮导航回原始文档。
语法
location.assign(URL)
参数
| 参数 | 描述 |
| URL | 必需。 要导航到的页面的 URL。 |
返回值
| 无 |
浏览器支持
location.assign() 在所有浏览器中都受支持
| Chrome | Edge | Firefox | Safari | Opera | IE |
| 是 | 是 | 是 | 是 | 是 | 是 |