Results 1 to 6 of 6

Thread: auto resizing an iframe to fit its content

  1. #1
    Join Date
    Sep 2018
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default auto resizing an iframe to fit its content

    I'm looking for something as the title that actually work for all the browser. I've searched all over the web and they all work more than perfect on Explorer and FireFox but not on Chrome.

    Can u guys help me?

  2. #2
    Join Date
    Jan 2009
    Location
    NH
    Posts
    673
    Thanks
    97
    Thanked 26 Times in 26 Posts

    Default

    Do you have any code yet? Do you have this in the <head> tag
    Code:
    <meta name="viewport" content="width=device-width, initial-scale=1">
    Are you using anything like Bootstrap or another system?

  3. #3
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,854
    Thanks
    49
    Thanked 259 Times in 251 Posts
    Blog Entries
    56

    Default

    Did you test them using Chrome online? I am saying this because Chrome does not execute javascript on the hard disk when it is related to iframes.

  4. #4
    Join Date
    Mar 2019
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    If you want only to fit the size of the iframe then check this below code in html

    HTML

    Code:
    <div id="output" style="width:500px;height:400px;">
        <iframe src="www.google.com" style="width:100%;height:100%;" id="ifrm"></iframe>
    </div>
    If you want the content also to be shrinked, then use the css transform as below
    
    CSS
    
    #ifrm {
        -ms-transform: scale(0.5); /* IE 9 */
        -webkit-transform: scale(0.5); /* Safari */
        transform: scale(0.5);
    }
    Last edited by james438; 03-06-2019 at 05:31 AM.

  5. #5
    Join Date
    Jul 2019
    Location
    Panama
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default auto resizing an iframe to fit its content

    I thought the iframe was finished but its an important part of html5. Could be useful...

    But onto more important thing; I have google search results on a site, and Ive resized the iframe to fit my page with sidebar so it looks OK on my 1024px laptop. Is there a way to dynamically resize this, so it looks better on most screens?

  6. #6
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,854
    Thanks
    49
    Thanked 259 Times in 251 Posts
    Blog Entries
    56

    Default

    There's more than one way to do it. Please give me the link to your page containing the iframe.

Similar Threads

  1. Auto resizing an iframe to fit its contents
    By mangfpt in forum Looking for such a script or service
    Replies: 3
    Last Post: 07-23-2019, 03:55 AM
  2. Auto resizing an iframe to fit its contents
    By bojomojo in forum Looking for such a script or service
    Replies: 25
    Last Post: 01-25-2011, 07:10 AM
  3. Auto resizing an iframe to fit its contents
    By *Scarface* in forum Looking for such a script or service
    Replies: 0
    Last Post: 08-09-2010, 11:58 AM
  4. Resizing an iframe based on content from different domains
    By evanmoore in forum Submit a DHTML or CSS code
    Replies: 0
    Last Post: 07-29-2009, 11:48 PM
  5. Auto-resizing IFrame?
    By Moglizorz in forum HTML
    Replies: 5
    Last Post: 04-21-2007, 11:32 PM

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
  •