Apologies, I spoke out of context. The browser security issue occurs when you use script to stretch the iFrame to always prevent the display of scroll bars. For example, in the page sample below, I want the user to be oblivious that the content is in an iFrame. Using this script, as long as the iFrame container page and the iFrame document page are in the same domain (i.e. same or different hosts in the same domain), the code works and the iFrame never displays vertical scroll bars. However, when the iFrame document is in a different domain, browser security (IE & Netscape), will not allow the contentWindow properties to be accessed. I work around this by trapping the security error and setting the iFrame height to a fixed value in those situations.
<html>
<head>
<script language="Javascript">
function stretchIFrame(frameName,minHeight)
{
contentHeight = 0;
try
{
contentHeight=document.getElementById(frameName).contentWindow.document.body.scrollHeight+50;
}
catch(err){}
if (contentHeight < minHeight) contentHeight = minHeight;
document.getElementById(frameName).style.height=contentHeight;
}
</script>
<iframe id="myframe" frameborder="no" src="http://www.dotnetnuke.com" height="1" width="400" title="DotNetNuke" scrolling="auto" onload="stretchIFrame('myframe','100')">
</iframe>
</html>
Nik Kalyani
Speerio, Inc.
[DotNetNuke and ASP.Net solutions
here]