I have an Iframe with a content loaded from different domain:
<div class="iframe">
<script language="javascript" type="text/javascript">
var queryString = unescape(document.location.search.split('?id=').join(''));
document.write("<iframe id=\"frame\" onload=\"resize()\" src=\"http://differentdomain.com/" + queryString + "\" scrolling=\"no\" width=\"850\" height=\"450\" frameborder=0></iframe>");
</script>
</div>
The content of an Iframe can be of different height.
I have a method resize()
executing when iframe loads as follows:
function resize() {
var iFrameID = document.getElementById("frame");
if (iFrameID) {
iFrameID.height = "";
iFrameID.height = iFrameID.contentWindow.document.body.scrollHeight + "px";
}
}
When running the page I have an access denied error, I'm assuming because of cross-domain issues.
How can I fix that, so my frame's heights will be changed dynamically based on its content?
Thank's