954,597 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Resize External Website in Iframe using Javascript.

Hello,

I am trying to resize an external website in an iframe using javascript, but have not found code that works very well. Anyone know how to go about it? Thanks in Advance!

lonestar23
Light Poster
44 posts since Mar 2008
Reputation Points: 20
Solved Threads: 0
 

If the website loading in the URL has a fixed size then you would have to code something to dig through the iframe and remove the sites fixed width.

But if the sites content is bigger than the frame, there really isnt much you can do besides setting "overflow: hidden" to most of the elements in the iframe.

Drew
Junior Poster
166 posts since Apr 2004
Reputation Points: 25
Solved Threads: 7
 

The external sites will have a fixed width, but not a fixed height. The height would range from 700 pixels-850pixels. Just looking for something that measures a height of an external site, with no use of sever code.

lonestar23
Light Poster
44 posts since Mar 2008
Reputation Points: 20
Solved Threads: 0
 

You would have to use javascript and a onload event on the iframe.

(untested)

iframeName.onload=function() {
iframeName.style.height = iframe.document.body.innerHeight;
};


Something like that might work.

Drew
Junior Poster
166 posts since Apr 2004
Reputation Points: 25
Solved Threads: 7
 

Ok, I will test it out later today. Thanks!

lonestar23
Light Poster
44 posts since Mar 2008
Reputation Points: 20
Solved Threads: 0
 

lonestar23, did you ever find a solution to this?

agfucious
Newbie Poster
1 post since Jun 2010
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You