adjusting the height of an iframe to fit the contents.

C

Cal Who

I tried a couple of approches to adjusting the height of an iframe to fit
the contents.

I always get accessed denied.

A Javascript function that ran on onLoad also produced a denilal error.

Below is the last trial. The error points to 'document'

Has there been a change in the browses so that this is no longer possible?

Can you show me something that works.



<input type="button"
onclick="document.getElementById('myIframe').style.height
=myIframe.document.body.scrollHeight + 5" value="Ajust" />



Thanks
 
M

Martin Honnen

Cal said:
I tried a couple of approches to adjusting the height of an iframe to fit
the contents.

I always get accessed denied.

A Javascript function that ran on onLoad also produced a denilal error.

Below is the last trial. The error points to 'document'

Has there been a change in the browses so that this is no longer possible?

The same origin policy applies to client-side scripting. If you load
both the main document and the iframe document from the same origin then
your script in the main document can certainly read out properties of
the iframe document. However if the iframe contains a document from a
different origin (.e.g. the main document is from http://example.com/
and the iframe is from http://example.de/) then you will get the access
denied error with your attempt to read out the document or properties of
the document of the iframe.
 
C

Cal Who

Martin Honnen said:
The same origin policy applies to client-side scripting. If you load both
the main document and the iframe document from the same origin then your
script in the main document can certainly read out properties of the
iframe document. However if the iframe contains a document from a
different origin (.e.g. the main document is from http://example.com/ and
the iframe is from http://example.de/) then you will get the access denied
error with your attempt to read out the document or properties of the
document of the iframe.

I only used the source while testing anyway. So I now that I know I use a
file on my site which is what I need to do anyway.

Thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top