[英]How to receive messages with sandboxed iframes?
I have an html page with a iframe that is sandboxed, so it can't access parent DOM. 我有一个带有沙盒iframe的html页面,因此它无法访问父DOM。 But is there a way I can still send serialized data from the iframe to the parent with event listeners and from the parent to the iframe too?
但是有没有办法我仍然可以通过事件监听器将序列化数据从iframe发送到父级,也可以从父级发送到iframe?
Yes. 是。 You can use post messages either from an iframe to its parent, or from a parent to its iframe.
您可以使用从iframe到其父级或从父级到iframe的帖子。
postMessage
should work fine, even from within a sandboxed iframe
. 即使在沙盒
iframe
, postMessage
应该可以正常工作。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.