如何更改iframe内容? [英] How change a iframe content?
本文介绍了如何更改iframe内容?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
可能重复:
如何更改iframe内容跨域的样式?
大家好。
如果来自其他网站,是否可以更改iframe内容?
例如。
Is it possible to change an iframe content if it comes from another site? e.g.
<html>
<head></head>
<body>
<iframe src="http://www.google.com"></iframe>
</body>
</html>
谢谢。
推荐答案
不,但如果两个页面同意这样做,您可以进行通信,例如使用 window.postMessage
。这是一项保护您的安全功能。这是一个指向 jquery插件 window.postMessage包装器的链接,其中包含location.hash后备支持。
No, but you can communicate if both pages agree to do so, such as with window.postMessage
. This is a security feature for your protection. Here's a link to a jquery plugin window.postMessage wrapper with location.hash fallback support.
这篇关于如何更改iframe内容?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文