Image

Hi guys. I'm new to this community and javascript too. So, excuse me for stupid questions :)

I have a situation here:

Internet site, let us call it 'www.web1.com/page.php' has an IFRAME element. And the content of this IFRAME element is 'www.web2.com/cont.php'. I have javascript that changes IFRAME height dynamically according to the content height. It works OK, if i IFRAME content is from the same domain the IFRAME itself, for instance, if content is 'www.web1.com/content.php', then it works all right, but when IFRAME content comes from another domain 'www.web2.com/cont.php', it doesn't work...

Any ideas?

the code:

function change_iframe_size() {

	var iframe = document.getElementById('ifrm_id');
	if (!iframe) {
		iframe = document.all('ifrm');
	}
	if (window.opera) {
		iframe.style.height = 100;
		iframe.style.height=window.frames.ifrm.document.body.scrollHeight+50;
	} else {
		var browser = navigator.userAgent.toLowerCase();
		if (browser.indexOf('msie 6.0') >= 0) {
			iframe.style.height=window.frames.ifrm.document.body.scrollHeight;
		} else if (browser.indexOf('mozilla') >= 0) {
			iframe.style.height = 100;
			iframe.style.height=window.frames.ifrm.document.body.scrollHeight+60;
		}
        }
}


iframe:

<IFRAME  name="ifrm" id="ifrm_id" onload="change_iframe_size();"
src="http://www.web2.com/cont.php" width="600" height="1000" scrolling="auto"
frameborder="1"></IFRAME>