0
votes

am working on an iGoogle-like application. Content from other applications (on other domains) is shown using iframes.

How do I resize the iframes to fit the height of the iframes' content?

I've tried to decipher the javascript Google uses but it's obfuscated, and searching the web has been fruitless so far.

Update: Please note that content is loaded from other domains, so the same-origin policy applies.

2
To resize: stackoverflow.com/questions/819416/… (same origin policy applies)Abhitalks

2 Answers

2
votes

The solution - if the iframe is from the same domain, is to stretch the iframe height to the iframe content body height.

Since you are using iframes from another domain, you cannot do this for security reasons (the same-origin policy you cited).

There is hacky ways, but not with cross-browser compatibility.

** update: See if this link helps you in some way, using JSONP:

http://www.codeproject.com/Articles/42641/JSON-to-JSONP-Bypass-Same-Origin-Policy

-1
votes

The simplest way to do it is using CSS.

Process: import your iframe inside your website, then add the classes that you want to adjust inside your css.

When you need to over-right one of their css attribute element, simply use the !important feature.

Example:

.fb-likes{
width:100% !important;
}