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!

Recommended Answers

All 5 Replies

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.

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.

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.

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

lonestar23, did you ever find a solution to this?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.