window.location.href和window.top.location.href的區別


if (window.location.href == window.top.location.href) {     window.top.location.href = "/index.html"; }

top.window.location.reload即刷新父級頁面  中top是指父框架的對象

使用情況一般是有嵌套iframe 其iframe的父頁面為本<html><iframe src='2.htm'></iframe> <html>

 

2. 也就是 如果iframe中的 2.htm 里面 使用了: top.window.location.reload 那么就是 刷新父頁面

    如果2.htm里面使用的是: window.location.reload 那就是 刷新框架 自身頁面 即iframe中的頁面


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM