SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Mar 2004
    Location
    Grand Junction, CO
    Posts
    292
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Using Javascript to write an iframe and set the size

    I've got a Javascript function that embeds an iframe into a web page. Both the javascript file and iframe are served from mysite.com, and the iframe is written out to a page on example.com.

    How can I set the size of the iframe without explicitly setting it? Can I embed the iframe and then modify the size after the fact? This would be done from within the iframe itself. I don't know if it's possible though because of Javascript security permissions.

    Another thing I've considered is to do an HTTP call in the drawIframe function. Before it writes out the iframe, it'll perform an HTTP request to get the dimensions. Then it'll parse the output and set that as the frame size.

    If I can set the frame size without an extra HTTP call I'd love it...so I'd appreciate any ideas.

  2. #2
    SitePoint Guru
    Join Date
    Apr 2007
    Posts
    813
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    some work around to set iframe size, because this might be tricky.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •