举例说明: 若是A,B,C,D都是html,D是C的iframe,C是B的iframe,B是A的iframe,若是D中js这样写 "window.location.href"、"location.href":D页面跳转 "parent.location.href":C页面跳转 "top.location.href":A页面跳转 若是D页面中有form的话, html
若是访问的是iframe里面的页面,从新加载最外层的页面bash
if (window.top.location.href != window.location.href) { window.top.location.reload(); } window.location.href 是本页面跳转 window.top.location.href 是最外层的页面跳转 复制代码
1. history.go(0) 2. location.reload() 3. location=location 4. location.assign(location) 5. document.execCommand('Refresh') (尚在研究) 6. window.navigate("1.html") (跳转) 7. location.replace(location) 8. document.URL=location.href (好像不能实现, 尚在研究) 复制代码