[英]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.