【发布时间】:2018-01-12 14:12:06
【问题描述】:
我目前正在使用 javascript 制作 iframe,但是当我尝试使用 myIframe.contentWindow.document 访问 iframe 时,我收到以下错误:
DOMException: Blocked a frame with origin "http://localhost:8082" from accessing a cross-origin frame.
【问题讨论】:
标签: iframe
我目前正在使用 javascript 制作 iframe,但是当我尝试使用 myIframe.contentWindow.document 访问 iframe 时,我收到以下错误:
DOMException: Blocked a frame with origin "http://localhost:8082" from accessing a cross-origin frame.
【问题讨论】:
标签: iframe
出于安全目的,您不能编辑 iframe 的内容。由于引发了跨域错误,您似乎正在尝试在 iframe 中设置内容。您可以将 iframe 的内容复制到另一个对象,然后对其进行编辑。
如果这是真的需要考虑的事情......
通过 jQuery 使用 AJAX..How to copy iframe content to div?
如果使用 Chrome,请理解 Chrome 不支持本地 CORS...Deadly CORS when http://localhost is the origin
【讨论】: