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跨域访问自定义高度的更多相关文章

  1. IFrame跨域访问&&IFrame跨域访问自定义高度

    1.IFrame跨域访问: http://blog.csdn.net/fdipzone/article/details/17619673 2.IFrame跨域访问自定义高度: 由于JS禁止跨域访问,如 ...

  2. js iframe跨域访问

    1.什么是跨域? 2.前台解决跨域几种方法 2.1 动态创建script 2.2 使用document.domain 2.3使用HTML5新属性postMessage 2.4 利用iframe和loc ...

  3. iframe跨域访问

    js跨域是个讨论很多的话题.iframe跨域访问也被研究的很透了. 一般分两种情况: 一. 是同主域下面,不同子域之间的跨域: 同主域,不同子域跨域,设置相同的document.domian就可以解决 ...

  4. CP="CAO PSA OUR" 用P3P header解决iframe跨域访问cookie

    1.IE浏览器iframe跨域丢失Session问题 在开发中,我们经常会遇到使用Frame来工作,而且有时是为了跟其他网站集成,应用到多域的情况下,而Iframe是不能保存Session的因此,网上 ...

  5. 在IE浏览器中iframe跨域访问cookie/session丢失的解决办法

    单点登录需要在需要进入的子系统B中添加一个类,用于接收A系统传过来的参数: @Action(value = "outerLogin", results = { @Result(na ...

  6. javascript跨域、iframe跨域访问

    1.window 对象 浏览器会在其打开一个 HTML 文档时创建一个对应的 window 对象.但是,如果一个文档定义了一个或多个框架(即,包含一个或多个 frame 或 iframe 标签),浏览 ...

  7. 【HTML】iframe跨域访问问题

    概述 本地同一浏览器访问本地HTML文件和访问服务器端HTML文件,本地Iframe没有自适应高度,而服务器端的Ifrane自适应了高度. 1.问题重现: Chrome 版本 41.0.2272.10 ...

  8. iframe跨域访问出现的cookie问题,提供两种解决方案

    最近在java项目对接时出现的一个问题.A系统嵌入B系统页面时,使用iframe去嵌入B系统页面丢失sessionid,导致B系统认为是未进行登录的请求,从而跳转到了B系统登录页. 解决方法查看此博客 ...

  9. IE中iframe跨域访问

    http://blog.csdn.net/ghsau/article/details/13747943

随机推荐

  1. UICollectionView 浅析

    什么是UICollectionView UICollectionView是一种新的数据展示方式,简单来说可以把他理解成多列的UITableView(请一定注意这是UICollectionView的最最 ...

  2. IOS 使用动态库(dylib)和动态加载framework

    在iphone上使用动态库的多为dylib文件,这些文件使用标准的dlopen方式来使用是可以的.那相同的在使用framework文件也可以当做动态库的方式来动态加载,这样就可以比较自由的使用appl ...

  3. 借助XShell,使用linux命令sz可以很方便的将服务器上的文件下载到本地,使用rz命令则是把本地文件上传到服务器。

    rz 是将window文件传到linux服务器上,到执行rz命令的目录 sz 可以将linux文件发送到windows上,可以选择目录. https://www.google.com/ncr 登录一下 ...

  4. HDU1372:Knight Moves(BFS)

    Knight Moves Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 65536/32768K (Java/Other) Total ...

  5. #ifndef 和 #endif

    文件中的#ifndef 头件的中的#ifndef,这是一个很关键的东西.比如你有两个C文件,这两个C文件都include了同一个头文件.而编译时,这两个C文件要一同编译成一个可运行文件,于是问题来了, ...

  6. Chapter 1 First Sight——14

    I parked in front of the first building, which had a small sign over the door reading front office. ...

  7. 【啊哈!算法】算法7:Dijkstra最短路算法

    上周我们介绍了神奇的只有五行的Floyd最短路算法,它可以方便的求得任意两点的最短路径,这称为“多源最短路”.本周来来介绍指定一个点(源点)到其余各个顶点的最短路径,也叫做“单源最短路径”.例如求下图 ...

  8. 草,又学了个新命令,nc传文件。

    nc -l 5222 > aa nc 192.168.0.48 5222 < a http://www.linuxso.com/command/nc.html

  9. javascript OOP 面向对象编程

    Pseudo-class declaration 原文地址:http://javascript.info/tutorial/pseudo-classical-pattern#pseudo-class- ...

  10. Hadoop: failed on connection exception: java.net.ConnectException: Connection refuse

    ssh那些都已经搞了,跑一个书上的例子出现了Connection Refused异常,如下: 12/04/09 01:00:54 INFO ipc.Client: Retrying connect t ...