开发者

Set the Height of an IFRAME based on its Document's Height (Cross Domain)

开发者 https://www.devze.com 2023-03-29 12:15 出处:网络
I tried using the top.location.hash approach to have a site on a different domain (also within an iframe) set the top windows hash value to its own height, but I\'ve now discovered this isn\'t cross d

I tried using the top.location.hash approach to have a site on a different domain (also within an iframe) set the top windows hash value to its own height, but I've now discovered this isn't cross domain safe.

What other options do 开发者_Go百科I have to make sure that the iframe constantly resets it's height when the iframe document is finished loading?


You can use window.postMessage() to communicate across domains. See http://caniuse.com/#search=postmessage for the current level of support - pretty much all browsers and even MSIE starting with MSIE 8.

0

精彩评论

暂无评论...
验证码 换一张
取 消