【发布时间】:2015-12-14 10:39:36
【问题描述】:
我想使用 jquery 解析我的 iframe,例如,我需要在 iframe 文档中搜索字符串“Ctrl”。
我的 iframe 的网址:http://windows.microsoft.com/fr-xf/internet-explorer/ie-keyboard-shortcuts#ie=ie-11
$('#iframeIe').contents()
错误信息:
Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin "http://localhost:4000" from accessing a cross-origin frame.(…)
还有其他方法可以在页面上包含网站并解析它们吗?我的意思是解析他们的文本内容...
【问题讨论】:
-
是同域的frame还是可以修改cors header?
-
iframe 不在同一个域中,我在本地服务器上...
-
只有在你同时控制两个域的情况下才能做到这一点