[英]How do i access Iframe #document with javascript
我有这个框架我无法访问,从框架的初步检查,我注意到框架包含一个#document然后我写了一个代码来访问框架。
$body = document.body;
$body.children[3];
$yo = $body.children[3];
$yo.children[0];
$next = $yo.children[0];
$next.children[3];
$plus = $next.children[3];
$plus.children[0];
$star = $plus.children[0];
$star.children[0];
$staragain = $star.children[0];
$staragain.children[1];
$nextstar = $staragain.children[1];
$nextstar.children[1];
$afternext = $nextstar.children[1];
$afternext.contentWindow;
最后一行返回受限,并且
iframe.contentDocument
返回null
。 然后,我尝试使用iframe.children[0]
访问框架文档,该文档返回undefined
,然后我将数组打开,但是什么也没有发生。我在框架上运行的所有代码都返回undefined如何访问该框架#文献? 溜溜球 。
iframe.contentWindow.document
但仅在原点相同的情况下(由于同源政策) 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.