PC Review


Reply
Thread Tools Rate Thread

adjusting the height of an iframe to fit the contents.

 
 
Cal Who
Guest
Posts: n/a
 
      31st May 2010
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



 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      31st May 2010
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/
 
Reply With Quote
 
Cal Who
Guest
Posts: n/a
 
      1st Jun 2010

"Martin Honnen" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can't adjust the iFrame height to fit the contents. Cal Who Microsoft ASP .NET 1 2nd Jun 2010 03:21 PM
Automatically adjusting Row height JoeP Microsoft Excel Misc 1 26th Nov 2007 10:55 PM
iframe ie7 and height setting not working =?Utf-8?B?SmVycnkgQw==?= Microsoft ASP .NET 4 30th Oct 2007 01:02 PM
expand <td> to height of its iframe contents Steve Richter Microsoft ASP .NET 1 8th May 2005 12:20 AM
Re: VBA for adjusting row height JE McGimpsey Microsoft Excel Misc 1 25th May 2004 07:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:14 AM.