I have an iframe:
<iframe src="http://externaldomain.com/something.html">
If something.html from externaldomain.com has the css:
html { position: relative; }
In IE, it will render the iframe as blank. All other browser are fine.
Anyone know of a solution? Remember the same origin policy. I cannot alter anything within the iframe with javascript or change the css as the iframe src is external.
Thanks.
I would start by reading this Another Cross Domain iFrame Communication Technique and then look at a more elegant AJAX solution. I have seen a lot of situations where cross-domain iframes just don't work (and for good reason).
IFrames are one step above IE in the Axis of Evil (IMO)
Use the following syntax it will work.
Give the style="position:relative;" to your iframe it will work in IE.
As a workaround, if all else fails, you can download the contents of something.html using server-side logic, like ASP.NET or PHP, and save it on your local web-server somewhere. Then you can avoid the same-origin policy, or you can even modify the HTML/CSS yourself on the server, for ex., remove the offending position:relative.
iframe must have attribute ID
window.parent.document.getElementById('iframeid').contentWindow.document.execCommand('print', false, null);