Home  >  Article  >  Backend Development  >  关于iframe 跨域,该如何处理

关于iframe 跨域,该如何处理

WBOY
WBOYOriginal
2016-06-13 13:52:211041browse

关于iframe 跨域

关于iframe 跨域

一个页面a.htm 有一个 iframe iframe1,iframe1 里是b.hml, b.hml 里有一个 iframe2, 如何获得 iframe2的 的body.innerhtml 了 


window.frames['iframe1'].document.body.innerHTML;

这是获取第一个 iframe的 可是要获取 iframe2的  

该怎么获取了 

跨域吗? 如何实现了

------解决方案--------------------
jquery 的jsonp可以解决

跟iframe无关
------解决方案--------------------
这个跟“域”没有关系,域是指“a.com”到“b.com”

你这个看看js的parents,document之类的层次关系就可以了

Statement:
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