简体   繁体   English

未捕获的DOMException:无法读取“ contentDocument”

[英]Uncaught DOMException: Failed to read the 'contentDocument'

Ever since I have installed an SSL certificate, I have an issue with running a js targeting some information coming from an iframe. 自从我安装了SSL证书以来,我就遇到了运行js来定位来自iframe的某些信息的问题。

I keep getting: 我不断得到:

Uncaught DOMException: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin " https://www . *** .ro" from accessing a cross-origin frame. 未捕获的DOMException:无法从“ HTMLIFrameElement”读取“ contentDocument”属性:阻止了源为“ https:// www 。*** .ro”的框架访问跨域框架。

While searching the internet I found out this is a security issue that won't allow you to load files from another domain or subdomain but the thing is, I am not loading from a subdomain or a different domain. 在搜索互联网时,我发现这是一个安全问题,不允许您从另一个域或子域加载文件,但事实是,我不是从子域或其他域加载文件。 I am loading directly from the same domain/iframe.php . 我直接从同一domain / iframe.php加载。

This happened right after adding an SSL certificate, before that, the exact same script worked without issues. 添加SSL证书后就发生了这种情况,在此之前,完全相同的脚本没有问题。

Try using object and embed to simulate a iframe maybe this works 尝试使用对象并嵌入以模拟iframe,也许这可行

<object data="https://...." width="600" height="400">
    <embed src="https://...." width="600" height="400"> </embed>
</object>

The issue was one of absolute vs relative url for the iframe. 问题是iframe的绝对网址与相对网址之一。

I initially used the website's full url ( https://www.***.ro/iframe.php ) which made it look like trying to load a page from another domain even if it wasn't. 最初,我使用了网站的完整URL( https://www.***.ro/iframe.php ),这看起来像试图从另一个域加载页面,即使不是。 Once I changed it to simply ../iframe.php everything is back to normal. 一旦将其更改为简单的../iframe.php一切都将恢复正常。

暂无
暂无

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

相关问题 Uncaught SecurityError:无法读取&#39;contentDocument&#39;属性 - Uncaught SecurityError: Failed to read the 'contentDocument' property 未捕获的 DOMException:无法读取“cssRules”属性 - Uncaught DOMException: Failed to read the 'cssRules' property 未捕获的SecurityError:无法从“ HTMLIFrameElement”读取“ contentDocument”属性:阻止了框架 - Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame Uncaught SecurityError:无法从'HTMLIFrameElement'读取'contentDocument'属性 - Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement' 未捕获的 DOMException:无法从“CSSStyleSheet”读取“规则”属性 - Uncaught DOMException: Failed to read the 'rules' property from 'CSSStyleSheet' 未捕获的DOMException:无法从“ CSSStyleSheet”读取“ cssRules”属性 - Uncaught DOMException: Failed to read the 'cssRules' property from 'CSSStyleSheet' Uncaught SecurityError:无法从'HTMLIFrameElement'读取'contentDocument'属性:阻止了一个源为“https:// localhost”的帧 - Uncaught SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement': Blocked a frame with origin “https://localhost” SecurityError:无法从“ HTMLIFrameElement”读取“ contentDocument”属性 - SecurityError: Failed to read the 'contentDocument' property from 'HTMLIFrameElement Iframe chrome:未捕获的 DOMException:无法从“窗口”读取“localStorage”属性:拒绝访问此文档 - Iframe chrome : Uncaught DOMException: Failed to read the 'localStorage' property from 'Window': Access is denied for this document 未捕获的 DOMException:无法从“IDBRequest”读取“结果”属性:请求尚未完成 - Uncaught DOMException: Failed to read the 'result' property from 'IDBRequest': The request has not finished
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM