Forum Moderators: open

Message Too Old, No Replies

IFrame Resize Problem in Portal

         

lan realhanton

2:07 pm on May 3, 2006 (gmt 0)



For resizing IFrame according the size of screen area,I write the following code in IFrame portlet.

<script language="Javascript">

function dyniframesize(iframename) {
var pTar = null;
if (document.getElementById){
pTar = document.getElementById(iframename);
}
if (pTar &&!window.opera){
pTar.style.display="block"

if (pTar.contentDocument && pTar.contentDocument.body.offsetHeight){
pTar.height = pTar.contentDocument.body.offsetHeight+20;
}
else if (pTar.Document && pTar.Document.body.scrollHeight){
pTar.height = pTar.Document.body.scrollHeight+4;
}
}
}
</script>

<iframe id="IFrameId1" onload="javascript:{dyniframesize('IFrameId1');}" width="1" frameborder="1" src="http://jim.ibm.lan:9081/lms-lmm/redirect.do?ignoreTimeout=true&LMSRedirectUrl=/default.do?nav=xyz"></iframe>

the scr of Iframe: [jim.ibm.lan:9081...]

it excute the "doperform" method of Action class,navigate to the correct jsp page.

when the iframe page is in the same server as the parent page, the code can work correctly. However, when Iframe page is on the pther server, the code can not work, Iframe can not resize. The parent page and iframe page should in the same server? if they do not located in the same server,have some methods to resolve the problem(auto resize)? Thank you.

ajkimoto

9:26 pm on May 4, 2006 (gmt 0)

10+ Year Member



Hi lan,

first of all:

Welcome to Webmaster World!

As for your problem it looks like you are running into Javascript cross-domain security. A script running on a page from one domain cannot access a page from another domain for security reasons.

There is a way to override this on an Apache server using mod_proxy, but I have never done so myself. Try googling 'mod_proxy' and you should find a site that explains how to do do it.

ajkimoto