最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

javascript - Uncaught DOMException: Failed to read the 'contentDocument' - Stack Overflow

matteradmin6PV0评论

Ever since I have installed an SSL certificate, I have an issue with running a js targeting some information ing from an 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.

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 .

This happened right after adding an SSL certificate, before that, the exact same script worked without issues.

Ever since I have installed an SSL certificate, I have an issue with running a js targeting some information ing from an 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.

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 .

This happened right after adding an SSL certificate, before that, the exact same script worked without issues.

Share Improve this question asked Feb 18, 2017 at 16:50 AlinAlin 1,2285 gold badges22 silver badges48 bronze badges 1
  • Show us the code? – Raymond Nijland Commented Feb 18, 2017 at 16:56
Add a ment  | 

2 Answers 2

Reset to default 1

Try using object and embed to simulate a iframe maybe this works

<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.

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. Once I changed it to simply ../iframe.php everything is back to normal.

Post a comment

comment list (0)

  1. No comments so far