views:

48

answers:

3

I searched over google as well as few answers from stackoverflow but none of teh solution worked for me. Is there any working solution available ,

Thanks you very much

Rohit.

A: 

try calling a parent window function from your iframe

Vivek Mehra
This does not work cross domain
Mic
+2  A: 

The IFRAME need to send to the main page its body size.

For modern browsers you can use parent.postMessage from the IFRAME and have a listener in the main page to receive the value and resize the IFRAME.

For older browsers you can use tricks like passing data i.e. through windows.name or the window.location.hash But with those tricks you will have to poll with a setInterval to check for changes.

Mic
Thanks you very much for teh details
Rohit Desai
A: 

@Rohit I would suggest taking a look at this website. This should solve your problem http://benalman.com/projects/jquery-postmessage-plugin/

A functional demo can be found here: http://benalman.com/code/projects/jquery-postmessage/examples/iframe/

I plan to use this technique for a project of mine after I saw that I'm able to calculate the height across domain using query and postmessage. What's nice is it'll default to document.location.hash for older browsers.

Evan