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?

Who is Participating?
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
Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

Gurvinder Pal SinghCommented:
<<there is a way to automatically set the "content.html" width and height without being static?>>
what does this mean?
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!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.