0

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.

Rohit Desai
  • 25
  • 1
  • 4

3 Answers3

3

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
  • 24,812
  • 9
  • 57
  • 70
  • Thanks you very much for teh details – Rohit Desai Aug 19 '10 at 12:46
  • 1
    here's an article and code example of refinements to this hash hack method: http://www.onlineaspect.com/2010/01/15/backwards-compatible-postmessage/ – Kyle Cureau Nov 23 '10 at 00:30
  • And here's an easy example on stackoverflow: http://stackoverflow.com/questions/5606920/cross-domain-iframe-resizer/6940531#6940531 – thomax Aug 04 '11 at 11:32
0

@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
  • 3,411
  • 7
  • 36
  • 53
-2

try calling a parent window function from your iframe

Vivek Mehra
  • 177
  • 2
  • 3
  • 9