自动调整大小的iframe跨域 [英] auto-size iframe cross domain

查看:144
本文介绍了自动调整大小的iframe跨域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用iframe和javascript制作一个Web小部件,并且我想让我的iframe可调整大小到它的内容(从其他域加载)。

I am making a web widget using iframe and javascript and i would like to make my iframe resizable to it´s content (which is loaded from other domain).

我已经做了一些搜索(包括这里在StackOverflow),我找到几个主题,但我不能找到任何结论这个问题。

I have done some search(inclusive here at StackOverflow) and i find a couple of topics but i couldn´t find any conclusions about this issue.

这是可能的,不是?

因为atm我必须设置我的iframe高度为内容的最大高度,在我的部件的一些步骤给出了一个大的白色空间在底部,看起来很不错。

Because atm i have to set my iframe height to the maximum height of the content which in some steps of my widget gives a big white space at the bottom which dont look very good.

注意小部件中的所有交互iframe完全使用ajax完成。 (iframe src只是一个html页面)。

Note all the interactions inside the widget iframe are done completely with ajax. (The iframe src is just one html page).

推荐答案

查看 this :)也可以使用postMessage - 有一个crossbrowser jQuery插件。

Take a look at this :) Also you could use postMessage - there is a crossbrowser jQuery plugin.

这篇关于自动调整大小的iframe跨域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆