最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - How to get iframe contentWindow height in cross domain - Stack Overflow

programmeradmin1浏览0评论

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.

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.

Share Improve this question asked Sep 8, 2010 at 12:17 tanujdavetanujdave 2374 silver badges15 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 4

For modern browsers you can use the window.postMessage function to municate 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.

发布评论

评论列表(0)

  1. 暂无评论