获取跨域 iFrame 内容 [英] Get Cross-Domain iFrame content
本文介绍了获取跨域 iFrame 内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想知道如何从 IFrame 跨域获取内容?
I would like to know how I can get content from an IFrame cross-domain?
我从非跨域 iFrame 获取内容没有问题,但是当它位于另一个域时,JavaScript 不允许访问.
I have no problem getting content from a non-cross-domain iFrame, but when it's located on another domain, JavaScript doesn't allow access.
推荐答案
如果不能通过您自己服务器上的代理请求它,您就不能.
Short of requesting it via a proxy on your own server, you can't.
同源政策阻止了它(并且有充分的理由;如果您在 iframe 中加载了我的银行网站并阅读了我的所有帐户详细信息)
The same origin policy prevents it (and for good reason; I would be very unhappy if you loaded my banking site in your iframe and read all my account details)
这篇关于获取跨域 iFrame 内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文