Rohit Desai
Rohit Desai

Reputation: 25

cross domain iframe adjust height automatically

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.

Upvotes: 0

Views: 3932

Answers (3)

Evan
Evan

Reputation: 3511

@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.

Upvotes: 0

Mic
Mic

Reputation: 25184

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.

Upvotes: 3

Vivek  Mehra
Vivek Mehra

Reputation: 177

try calling a parent window function from your iframe

Upvotes: -2

Related Questions