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
随机推荐
- mysql 货币字段类型的存储
loat类型是可以存浮点数(即小数类型),但是float有个坏处,当你给定的数据是整数的时候,那么它就以整数给你处理.这样我们在存取货币值的时候自然遇到问题,我的default值为:0.00而实际存储 ...
- Override/implements methods 如何添加
用过Eclipse 的ADT的都知道,要快速添加override或者implements方法,右键---Source---Override/Implements Method... 中文:右键---& ...
- Light OJ 1006 - Hex-a-bonacci
题目链接:http://acm.hust.edu.cn/vjudge/contest/121396#problem/G http://lightoj.com/volume_showproblem.ph ...
- Excel工作表 表名导出
Technorati 标签: microsoft office,vbs,excel 1: Attribute VB_Name = "表名导出" 2: Sub test() 3: ...
- PHP程序员学习路线
注:本文是@黑夜路人的旧文,假设PHP程序员基础不是非常扎实,简单梳理了每个阶段PHP程序员的技术要求,来帮助很多PHP程序做对照设定学习成长目标.再次分享,共勉,欢迎补充. 第一阶段:基础阶段(基础 ...
- Servlet程序开发-Helloworld
D:\Workspace\WEB-INF\classes下新建HelloServlet.java文件: package org.lxh.servletdemo ; import java.io.* ; ...
- Android编译,模块的编译和CLEAN
在Android源代码目录下的build目录下,有个脚本文件envsetup.sh: $ . build/envsetup.sh 注:该命令的前面的逗点(.),相当于source. 执行这个脚本文件后 ...
- windows 2003添加删除windows组件中无iis应用程序服务器项的解决方法
解决方法如下: 1.开始 -- 运行,输入 c:\Windows\inf\sysoc.inf,会打开这个文件;在sysoc.inf中找到"[Components]"这一段,并继续找 ...
- Android之EditText控件
<EditText android:layout_width="fill_parent" android:layout_height="wrap_content&q ...
- Python3基础 定义有参数有返回值函数 对传入的参数加1
镇场诗: 诚听如来语,顿舍世间名与利.愿做地藏徒,广演是经阎浮提. 愿尽吾所学,成就一良心博客.愿诸后来人,重现智慧清净体.-------------------------------------- ...