URL相关
语句 | 备注 |
---|---|
window.location.href | 当前页面完整的URL(http://localhost:8080/yies-web/YOFA810G010?PRG) |
window.location.host | (localhost:8080) |
window.location.hostname | (localhost) |
window.location.origin | (http://localhost:8080) |
window.location.pathname | (/yies-web/YOFA810G010) |
window.location.port | (8080) |
window.location.protocol | (http:) |
window.location.search | (?PRG) |
页面刷新
语句 | 备注 |
---|---|
location.reload(); | 刷新当前页面 |
history.go(0); | 刷新当前页面 |
location.replace(document.referrer); | 返回并刷新页面(document.referrer⇒前一个页面的URL) |
history.go(-1); | 返回前一个页面,不会刷新页面 |
history.back(); | 返回前一个页面,不会刷新页面 |