i want to auto adjust my iframe height according to their content but in same domain it's work properly with contentWindow.height but in case of cross domain its permission denied for accessing iframe dom.
For modern browsers you can use the window.postMessage
function to communicate between the iFrames belonging to two different domains.
There are also several jQuery plugins that wrap window.postMessage
with older URL hashing techniques for browsers that don't support window.postMessage
. It makes the usage of the technology transparent to the end user.
You can look at the following page (and probably borrow the javascript you need) from here:
Lutron - Ballast Selection Tool
The tool with the dropdowns is actually being loaded from a separate domain into an iFrame. The iFrame is then dynamically resized based on the height of the inner content.
@tanujdave would you be able to share a demo of what you're trying to do or even completed? I'd love to learn from you how to replicate the same approach using Jquery.
I was able to calculate the height of an iframe across domain not using Jquery, but I would love to see how you approached your same challenge using jquery. If you'd like to see my example, I can make it available to you. I'd just have to create a page to support it, since I don't want to link my project here.