Say I have a website which for example has the following CSS class:
div { border: red; }
And I would like to display e-mail's stored in a database somewhere on the same page with the CSS class. The e-mail has the following HTML:
<div style='height: 500px; background-color: red;'>Hello, I am an e-mail!</div>
Showing that HTML on my webpage will give it a red border. I would like the e-mail's HTML & CSS not be affected by the already present CSS, therefore I use an iframe in the following way:
<iframe
src="data:text/html;charset=utf-8,<div style='height: 500px; background-color: red;'>Hello, I am an e-mail!</div>"
></iframe>
This works fine, however the iFrame is not responsive to the size of the e-mail (500px in the example). Therefore I add the following property:
onload="this.height=this.contentWindow.document.body.scrollHeight;"
This works perfectly when I request a webpage on the same domain. However the way I am using it now I receive the following error:
I am not requesting any data from another origin, could someone please explain me why this is happening and if there is a workaround?