Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

Setting new Height and Width over iframe


For example, when i use an iframe, example

<iframe src="somesite">your browser doesnt support iframes</iframe>

ok, but the source (somesite) has your own width and height and how to update on the client (the page that will show the iframe content) the exact size of the source (somesite in this case)?


index.html will host the iframe content
content.html is the iframe content

index.html should show in an iframe, the content.html but with it exactly size... no matter the width or height of the content, index.html will adjust it...

some idea?

  • 3
  • 2
  • 2
1 Solution
Gurvinder Pal SinghCommented:
try something like this

<iframe src="somesite" style='width:100px;height:150px;'>your browser doesnt support iframes</iframe>
cebassoAuthor Commented:
but setting the width and height, will make my iframe 100px x 150px with scrollbars

there is a way to automatically set the "content.html" width and height without being static?

i mean, doesnt matter the width and height of the content... iframe will adjust automatically
Gurvinder Pal SinghCommented:
<<there is a way to automatically set the "content.html" width and height without being static?>>
what does this mean?
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

cebassoAuthor Commented:
Thank you all for help, anyway there is no working example since my iframes is cross domain...
many erros like "Permission denied"...

but i found this that really work


Works perfectly cross domain too... except in Google Chrome that keep refreshing the page forever...

the link below i'm using to test... it already contains all scripts from link above...


Will resize perfectly except in Chrome like i said above...

anyone know how to fix it?

cebassoAuthor Commented:
Thank you!

Featured Post

[Webinar On Demand] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now