舉例說明: 若是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 (好像不能實現, 尚在研究) 複製代碼