简体   繁体   English

如何使用JavaScript访问iframe #document

[英]How do i access Iframe #document with javascript

I have this frame i cannot access,from initial inspection of the frame i noticed the frame contained a #document then i wrote a code to access the frame. 我有这个框架我无法访问,从框架的初步检查,我注意到框架包含一个#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;        

The last line returns restricted,and 最后一行返回受限,并且
iframe.contentDocument returns null . iframe.contentDocument返回null Then i tried to access the frame document which is a #document with iframe.children[0] it returned undefined ,then i left the array open but nothing happened.All codes i run on the frame returns undefined how do i access this frame #document? 然后,我尝试使用iframe.children[0]访问框架文档,该文档返回undefined ,然后我将数组打开,但是什么也没有发生。我在框架上运行的所有代码都返回undefined如何访问该框架#文献? yoyoyo . 溜溜球

iframe.contentWindow.document但仅在原点相同的情况下(由于同源政策)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM