0x80070005-尝试访问iframe DOM元素时拒绝访问

0x80070005-尝试访问iframe DOM元素时拒绝访问,dom,com,autohotkey,Dom,Com,Autohotkey,尝试访问iframe元素的contentWindow.document时,出现错误,0x80070005-访问被拒绝。 无法访问iframe文档的元素吗 文件: iframe.html iframe_test.ahk iframe.html <html> <head></head> <body> <iframe width="100%" height="100%" name="myframe" src="h

尝试访问iframe元素的contentWindow.document时,出现错误,
0x80070005-访问被拒绝。

无法访问iframe文档的元素吗

文件:

  • iframe.html
  • iframe_test.ahk
iframe.html

<html>
    <head></head>
    <body>
        <iframe width="100%" height="100%" name="myframe" src="http://www.w3schools.com"></iframe>
    </body>
</html>     

通常情况下,这些错误是由于同一来源策略而发生的


通常,您最好依靠类似于或编写用户脚本的方式来绕过同源策略。

这是可能的。但是,这样做时存在跨域限制。如果您试图通过iframe访问w3schools网站上的内容,但无法正常工作,因为您的域没有权限。换句话说,无法从本地文件访问。谢谢你的评论。
Gui, New, Resize MaximizeBox
Gui, Add, ActiveX, vWB w780 h580, % A_ScriptDir "\iframe.html" 
Gui, show, w800 h600
Loop
   Sleep 10
Until (WB.readyState=4 && WB.document.readyState="complete" && !WB.busy)        
msgbox % WB.document.All["myframe"].contentwindow.document.documentElement.innerHTML