IFrame跨域访问自定义高度
1.IFrame跨域访问:
http://blog.csdn.net/fdipzone/article/details/17619673
2.IFrame跨域访问自定义高度:
由于JS禁止跨域访问,如何实现不同域的子页面将高度返回给父页面本身,是解决自定义高度的难点。
JS跨域访问问题描述:应用A访问应用B的资源,由于A,B应用分别部署在不同应用服务器(tomcat)上,属于不同域,JS禁止跨域访问。
解决方案:使用一个连接A,B应用的桥梁页面bradge.jsp来解决。
准备:
应用A localhost:8080
主页面:main.jsp/html
<div class="information_box" style="display:block;">
<iframe id="frame_content" name="frame_content" src="http://localhost:8888/applicationB/jsp/invokeB.jsp" width="100%" height="0" scrolling="no" frameborder="0"></iframe>
</div>
连接A,B应用的页面:bradge.jsp/html
<script>
function pseth() {
var iObj = parent.parent.document.getElementById('frame_content');
iObjH = parent.parent.frames["frame_content"].frames["iframeC"].location.hash;
iObj.style.height = iObjH.split("#")[1]+"px";
//alert('bridge');
}
pseth();
</script>
应用B localhost:8888
invokeB.jsp/html
<div id="crossDomain">
<iframe id="iframeC" name="iframeC" src="" width="0" height="0" style="display:none;" ></iframe>
</div> <script>
function newIframe(){
$("#iframeC").remove();
hashH = document.documentElement.scrollHeight;
$("#crossDomain").html("<iframe id='iframeC' name='iframeC' src='http://localhost:8080/applicationA/jsp/bradge.jsp#"+hashH+"' width='0' height='0' style='display:none;'></iframe>"); }
function sethash(){
newIframe();
}
sethash();
</script>
IFrame跨域访问自定义高度的更多相关文章
- IFrame跨域访问&&IFrame跨域访问自定义高度
1.IFrame跨域访问: http://blog.csdn.net/fdipzone/article/details/17619673 2.IFrame跨域访问自定义高度: 由于JS禁止跨域访问,如 ...
- js iframe跨域访问
1.什么是跨域? 2.前台解决跨域几种方法 2.1 动态创建script 2.2 使用document.domain 2.3使用HTML5新属性postMessage 2.4 利用iframe和loc ...
- iframe跨域访问
js跨域是个讨论很多的话题.iframe跨域访问也被研究的很透了. 一般分两种情况: 一. 是同主域下面,不同子域之间的跨域: 同主域,不同子域跨域,设置相同的document.domian就可以解决 ...
- CP="CAO PSA OUR" 用P3P header解决iframe跨域访问cookie
1.IE浏览器iframe跨域丢失Session问题 在开发中,我们经常会遇到使用Frame来工作,而且有时是为了跟其他网站集成,应用到多域的情况下,而Iframe是不能保存Session的因此,网上 ...
- 在IE浏览器中iframe跨域访问cookie/session丢失的解决办法
单点登录需要在需要进入的子系统B中添加一个类,用于接收A系统传过来的参数: @Action(value = "outerLogin", results = { @Result(na ...
- javascript跨域、iframe跨域访问
1.window 对象 浏览器会在其打开一个 HTML 文档时创建一个对应的 window 对象.但是,如果一个文档定义了一个或多个框架(即,包含一个或多个 frame 或 iframe 标签),浏览 ...
- 【HTML】iframe跨域访问问题
概述 本地同一浏览器访问本地HTML文件和访问服务器端HTML文件,本地Iframe没有自适应高度,而服务器端的Ifrane自适应了高度. 1.问题重现: Chrome 版本 41.0.2272.10 ...
- iframe跨域访问出现的cookie问题,提供两种解决方案
最近在java项目对接时出现的一个问题.A系统嵌入B系统页面时,使用iframe去嵌入B系统页面丢失sessionid,导致B系统认为是未进行登录的请求,从而跳转到了B系统登录页. 解决方法查看此博客 ...
- IE中iframe跨域访问
http://blog.csdn.net/ghsau/article/details/13747943
随机推荐
- GCC: compilation process..
gcc -Iproj/src myfile.c -o myfile gcc -c myfile.c "compile without linking gcc -D DEBUG myfile. ...
- IPSEC VPN配置实例
TL-R400VPN应用——IPSEC VPN配置实例 TL-ER6120是TP-LINK专为企业应用而开发的VPN路由器,具备强大的数据处理能力,并且支持丰富的软件功能,包括VPN.IP/MAC 地 ...
- pycharm快捷键、常用设置、配置管理
http://blog.csdn.net/pipisorry/article/details/39909057 pycharm学习技巧 Learning tips /pythoncharm/help/ ...
- Linux -- ls只显示目录
ls没有直接显示目录的选项, 不过根据目录和文件显示的差异,可以搭配grep来实现 方法1: ll | grep "^d" 方法2: ls -F | grep$ "/$& ...
- hadoop的安全模式
在安全模式下:不能增.删.改操作:但可以查看. 查看hadoop是否i处于安全模式下: 执行命令:hadoop dfsadmin -safemode get 进入hadoop的安全模式下: 执行命令: ...
- css初始化值
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,form,textarea,input,p,th,td,tr,table,tbody,thead,tfoot, ...
- Linux下find命令用法小结
find是个使用频率比较高的命令.常常用它在系统特定目录下,查找具有某种特征的文件. find命令的格式:find [-path……] -options [-print -exec -ok] path ...
- 【贪心】时空定位II
[贪心]时空定位II 题目描述 有一块空间,横向长w,纵向长为h,在它的横向中心线上不同位置处装有n(n≤10000)个点状的定位装置,每个定位装置i定位的效果是让以它为中心半径为Ri的圆都被覆盖.请 ...
- One Bomb
One Bomb time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...
- DataSet和List<T> 泛型之间互相转换 (转载, 作者写的很好)
/DataSet与泛型集合间的互相转换 //利用反射机制将DataTable的字段与自定义类型的公开属性互相赋值. //注意:从DataSet到IList<T>的转换,自定义类型的公开属性 ...