![]() |
adjusting the height of an iframe to fit the contents.
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 |
Re: adjusting the height of an iframe to fit the contents.
Cal Who wrote:
> 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. -- Martin Honnen --- MVP Data Platform Development http://msmvps.com/blogs/martin_honnen/ |
Re: adjusting the height of an iframe to fit the contents.
"Martin Honnen" <mahotrash@yahoo.de> wrote in message news:u6iwGmNALHA.3840@TK2MSFTNGP02.phx.gbl... > Cal Who wrote: >> 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. > > -- > > Martin Honnen --- MVP Data Platform Development > http://msmvps.com/blogs/martin_honnen/ 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 |
| All times are GMT. The time now is 12:58 AM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.