【发布时间】:2017-05-20 08:09:03
【问题描述】:
我正在尝试在此 iframe 中获取 .av-video-player-bg 的背景图片 URL:
<iframe src="http://www.gamespot.com/videos/embed/6425430/"></iframe>
我试过了
$("iframe").contents().find('.av-video-player-bg').css('background-image');
但我收到此错误:
无法从“HTMLIFrameElement”读取“contentDocument”属性:阻止具有“http://www.gamespot.com”来源的框架访问跨域框架。
【问题讨论】:
-
不能,那是同源策略。
-
@epascarello 谢谢????
标签: javascript jquery css iframe cross-domain