PDA

View Full Version : Autoresize iframe don' work!



ajorg
05-03-2005, 08:24 PM
Hi,

I've tried the iframe autoresize script from Dynamic Drive,
http://www.dynamicdrive.com/dynamicindex17/iframessi2_dev.htm
but it only works if the document inside the iframe is on the same server.

I have two webservers and I want to be able to show webpages from webserver 2 inside the iframe on webserver 1. Is this possible?

Firefox generate following error in the Javascript console:
Error: [Exception... "'Permission denied to get property HTMLDocument.body' when calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no]

Thanks

jscheuer1
05-04-2005, 03:11 AM
Using absolute paths may help.

One thing you haven't made clear is -

Is the error the result of showing the content in the iframe, or is it the result of the content attempting to resize the iframe?

An obvious approach would be to put the pages all on one server, use the extra server only for content that doesn't cause a problem.

Another approach would be to put the resizable iframe on the remote server and an additional fullpage iframe or, a frame page with only one frame, on the main server to contain all that.

2

ajorg
05-04-2005, 09:17 PM
I'm using absolute paths. The error shows up when I load the page with the iframe. I don't have any problems when the iframe source file is local but as soon as I try to load an external page the error pops up and the iframe don't resize anymore. I've found several autoresize scripts but they all have the same problem with cross domain.

It seems to be a security issue. I've found some documentation at
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/inlinefloatingframes.asp
and
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/overview/inlinefloatingframes.asp

I'm not a JS expert, so I don't know how to solve the problem if it can be solved.

jscheuer1
05-05-2005, 03:56 AM
Another approach would be to put the resizable iframe on the remote server and an additional fullpage iframe or, a frame page with only one frame, on the main server to contain all that.Have you tried this suggestion?