adjusting the height of an iframe to fit the contents.

Discussion in 'ASP .Net' started by Cal Who, May 31, 2010.

  1. Cal Who

    Cal Who Guest

    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
    Cal Who, May 31, 2010
    #1
    1. Advertising

  2. 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/
    Martin Honnen, May 31, 2010
    #2
    1. Advertising

  3. Cal Who

    Cal Who Guest

    "Martin Honnen" <> wrote in message
    news:...
    > 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
    Cal Who, Jun 1, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Piet
    Replies:
    0
    Views:
    518
  2. Adam Smith

    Adjusting Input field size (height)

    Adam Smith, Sep 9, 2006, in forum: HTML
    Replies:
    3
    Views:
    12,911
    Jukka K. Korpela
    Sep 9, 2006
  3. Replies:
    2
    Views:
    1,619
    Ben C
    Apr 2, 2007
  4. Cal Who
    Replies:
    1
    Views:
    921
    Cal Who
    Jun 2, 2010
  5. Jesse Joseph Acosta

    Adjusting the width and height of a popup window

    Jesse Joseph Acosta, Nov 18, 2003, in forum: Javascript
    Replies:
    1
    Views:
    101
Loading...

Share This Page