[英]Accessing external iframe content
I have a page with an iframe A whose src attribute is a url that iteself contains an iframe B A. I want to access the src of this embedded iframe B. Is this possible at all? 我有一个带有iframe A的页面,其src属性是一个本身包含iframe B A的网址。我想访问此嵌入式iframe B的src。这可能吗? It seems browser security won't let this happen since the embedded iframe B comes from outside the domain of my iframe A.
由于嵌入式iframe B来自我的iframe A的域之外,因此浏览器的安全性似乎无法阻止这种情况的发生。
You are correct; 你是对的; this is completely impossible.
这是完全不可能的。
Otherwise, I could write a page that loads Gmail in a hidden <iframe>
and read your email. 否则,我可以写一个页面来在隐藏的
<iframe>
中加载Gmail并阅读您的电子邮件。
yea the browser security prevents you 是的,浏览器安全性阻止您
but theres other ways of getting crossdomain content you can use http://developer.yahoo.com/yql/ 但是还有其他获取跨域内容的方法,您可以使用http://developer.yahoo.com/yql/
there some plugins for jquery to if thats you cup 有一些jQuery插件,如果多数民众赞成你
HTML5 actually has a security model for this. HTML5实际上为此具有一个安全模型。 Check out PostMessage in HTML5 compliant browsers.
在兼容HTML5的浏览器中查看PostMessage。 There is a demo here: http://html5demos.com/postmessage2
这里有一个演示: http : //html5demos.com/postmessage2
If not, jQuery has a nice plugin that supports this, and even has a fallback to using the anchor tag to communicate if running in a browser that does not support PostMessage properly: http://benalman.com/projects/jquery-postmessage-plugin/ 如果不是这样,则jQuery会提供一个不错的插件来支持此功能,并且如果在不正确支持PostMessage的浏览器中运行,jQuery甚至还会使用锚标记进行通信: http : //benalman.com/projects/jquery-postmessage-插入/
Good luck! 祝好运!
:) :)
You cannot for the reason you guessed at. 您无法基于您的猜测原因。 However, if you have control over the contents of that other domain's frame, there are ways you can add cross-domain frame communication.
但是,如果您可以控制其他域框架的内容,则可以使用多种方法添加跨域框架通信。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.