Home > Web Front-end > HTML Tutorial > iframe标签嵌套,刷新问题_html/css_WEB-ITnose

iframe标签嵌套,刷新问题_html/css_WEB-ITnose

WBOY
Release: 2016-06-21 08:50:40
Original
1383 people have browsed it

现在解决的不是一个id就能搞定的问题,突然觉得自己好�!


代码里面的iframe标签都是ExtJs打上去的,所以根本没去花精力去找生成的地方,

即使找到了,修改框架也是不科学的,


不废话了,开始使用的是:

        var alla = window.parent.frames;        for( i in alla){            console.log(alla[i].location.href);            if(alla[i].location.pathname=='对应的iframe链接'){                alla[i].location.reload();            }        }
Copy after login

这么做,之后一刷新,OK了,激动的我 不要不要的!

...然而,在谷歌上一跑,报错了,获取不到.pathname,

原因是谷歌只能获取最顶级的iframe,

而火狐可以获取嵌套的所有iframe, 把parent换成top也不好使

最后

<script>    var alla = window.parent.window.document.getElementsByTagName('iframe');    for( i in alla){        console.log(alla[i].getAttribute('src'));        if(alla[i].getAttribute('src')=='live/index'){            alla[i].src='live/index';        }    }</script>
Copy after login

搞定了,于是自己吊炸天了

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template