LissiS
asked on
Permission denied to get property HTMLDocument.getElementById when resizing iframe
I'm trying to get a JS script working which will resize an iframe containing my content to my client's webpage. The CMS for their website is located on the same linux server as my tomcat installation, and both are accessed from www.<their website>.com (although of course, mine is derected to the 8080 port for tomcat.)
The HTML in their CMS to link to my content is:
<iframe id="the_iframe" src="<Their website>:8080/formswizard/ showWizard Form.do?fo rmName=per sonalDetai ls" frameborder="0" width="100%" height="500px">Sorry your browser does not support our quotations, please call <tel number> for our telephone service</iframe>
The JS to resize is (Called from an init() function which is called onLoad()):
function calcHeight()
{
var newheight;
if(navigator.appName=="Mic rosoft Internet Explorer")
{
newheight=parent.document. getElement ById('the_ iframe').c ontentWind ow.documen t.body.scr ollHeight;
parent.document.getElement ById('the_ iframe').h eight= newheight;
}
else if(navigator.appName=="Net scape")
{
newheight=parent.document. getElement ById('the_ iframe').c ontentDocu ment.docum entElement .offsetHei ght;
parent.document.getElement ById('the_ iframe').s tyle.heigh t = (newheight +16) + "px";
}
}
When loading up their webpage with my content linked through, I get the error uncaught exception: Permission denied to get property HTMLDocument.getElementByI d, which is the same error as when they were on different servers. I was hoping that by moving them onto the same linux serer, it would solve this problem. Is there any way I can get this current setup to function correctly, or any workarounds I could use?
Thanks,
Lissi
The HTML in their CMS to link to my content is:
<iframe id="the_iframe" src="<Their website>:8080/formswizard/
The JS to resize is (Called from an init() function which is called onLoad()):
function calcHeight()
{
var newheight;
if(navigator.appName=="Mic
{
newheight=parent.document.
parent.document.getElement
}
else if(navigator.appName=="Net
{
newheight=parent.document.
parent.document.getElement
}
}
When loading up their webpage with my content linked through, I get the error uncaught exception: Permission denied to get property HTMLDocument.getElementByI
Thanks,
Lissi
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I don't know of a simple way with sites not on your domain. Javascript should give you a Permission Denied error in that case, because Javascript is not allowed to run cross-site.