当系统出现异常时,ifrme中显示的内容为错也页面,而不是罪顶层的框架显示错误内容,此时的解决办法是在错误页面或相关的登录页面中加入

错误页面加载的JS如下
 <script type="text/javascript" language="javascript">

     onload = function () {
/// 当显示错误页面时,首先判断iframe和最顶层的top相关的location是否为同一个对象,如果不是同一对象,
/// 让系统定位到最顶层的框架top,且让top刷新(有可能系统重新登录的,此时需要获取最新的用户数据)
if (window != top) {
top.location.href = top.location.href;
} //
//if (this.location != this.parent.location) {
// alert("this.location != this.parent.location");
// this.location = this.parent.location;
//}
} </script>

给iframe定位使用的参考脚本
 /// iframe页面跳转
function NationDir(path, title) {
var heigth = $(window).height() - 57 - 55;
var width = $("div.orderMain").width() + 20;
alert(path);
$("#frameCheckIn").attr("src", path).css({ "height": heigth, "width": width }).show();
document.title = title;
$("div.orderMain").hide();
} /// 提供给子页面的返回函数
function GoBack() {
if (window != top) {
top.location.href = location.href;
} if (this.location != this.parent.location) {
this.location = this.parent.location;
}
SearchData(); var pageNew = document.getElementById("frameCheckIn");
$(pageNew).attr("src", "").hide(); //clear frame content
if (pageNew.contentDocument && pageNew.contentDocument.document) {
pageNew.contentDocument.document.body.innerHTML = "";
}
else if (pageNew.contentWindow && pageNew.contentWindow.document) {
pageNew.contentWindow.document.innerHTML = "";
}
document.title = "出入库检查";
$("div.orderMain").show(0);
}
 子页面调用返回iframe的返回操作代码参考
 function ViewBack() {
var bodyparent = parent.GoBack;
if (bodyparent != undefined) {
bodyparent();
}
}

iframe显示错误页面的更多相关文章

  1. Asp.net有关访问页面权限的限制和错误页面配置

    一.访问页面权限的限制 一个小项目,涉及到用户登录. 在用户没登录访问内容也时,对页面做一定限制,没登录的则不能访问,直接跳转到登录界面. /// <summary> /// 对没有登录用 ...

  2. ASP.NET网站中设置404自定义错误页面

    在用ASP.NET WebForm开发一个网站时,需要自定义404错误页面. 做法是这样的 在网站根目录下建立了一个404.html的错误页面,然后在Global.asax文件中,加入如下代码: &l ...

  3. ASP.NET MVC 自定义错误页面心得

    自定义错误页面的目的,就是为了能让程序在出现错误/异常的时候,能够有较好的显示体验. 所以,首先要先了解,我们可以在哪里捕获异常. 当程序发生错误的时候,我们可以在两个地方捕获: Global里面的A ...

  4. 新西兰程序员 ASP.NET网站中设置404自定义错误页面

    新西兰程序员 ASP.NET网站中设置404自定义错误页面 在用ASP.NET WebForm开发一个网站时,需要自定义404错误页面. 做法是这样的 在网站根目录下建立了一个404.html的错误页 ...

  5. ASP.NET Core中显示自定义错误页面-增强版

    之前的博文 ASP.NET Core中显示自定义错误页面 中的方法是在项目中硬编码实现的,当有多个项目时,就会造成不同项目之间的重复代码,不可取. 在这篇博文中改用middleware实现,并且放在独 ...

  6. ASP.NET Core中显示自定义错误页面

    在 ASP.NET Core 中,默认情况下当发生500或404错误时,只返回http状态码,不返回任何内容,页面一片空白. 如果在 Startup.cs 的 Configure() 中加上 app. ...

  7. asp.net中当服务器出错时显示指定的错误页面

    http://blog.csdn.net/helloxiaoyu/article/details/2943537 此篇文章描述了当异常再ASP.NET中发生时怎样使用C#.NET代码去拦截和相应异常. ...

  8. Nginx错误页面优雅显示

    一.Nginx错误页面优雅显示的原因?   当我们访问网站时,由于特殊的原因,经常会出现诸如403,404,503等错误,这极大的影响用户的访问体验,所以我们很有必要做一下错误页面的优雅显示,以提升用 ...

  9. JavaBean组件<jsp:forward>动作<jsp:param>动作登录页面输入用户名和密码,然后进入检查页面判断是否符合要求,符合要求跳转到成功界面,不符合要求返回登录界面,显示错误信息。

    JavaBean组件 JavaBean组件实际是一种java类.通过封装属性和方法成为具有某种功能或者处理某个业务的对象. 特点:1.实现代码的重复利用.2.容易编写和维护.3.jsp页面调用方便. ...

随机推荐

  1. sql实现对多个条件分组排序方法和区别

    转自: http://blog.csdn.net/winer2008/article/details/4283539 rank,dense_rank,row_number区别 一:语法(用法):    ...

  2. love your life

    However mean your life is, meet it and live it ;do not shun it and call it hard names. It is not so ...

  3. PG, Pool之间的一些数量关系

    先说一下我的环境: Ceph cluster中包含6台OSD节点 (osd.0 - 5), 一共有10个Pool (0 - 9), 这些Pool共享了144个PG (这个数字是所有Pool的PG_SI ...

  4. Code Snippet

    Code Snippet: http://msdn.microsoft.com/en-us/library/z41h7fat.aspx CodePlex.Snippets 4.0 - Visual S ...

  5. 当select框变化时 获取select框中被选中的值

    DOM <select name="course"> <option value="1">1</option> <op ...

  6. LeetCode Number of 1 Bits

    原题链接在这里:https://leetcode.com/problems/number-of-1-bits/ 题目: Write a function that takes an unsigned ...

  7. LeetCode Binary Tree Longest Consecutive Sequence

    原题链接在这里:https://leetcode.com/problems/binary-tree-longest-consecutive-sequence/ 题目: Given a binary t ...

  8. jQuery判断对象是否是函数

    var show=function () { // body... } if($.isFunction(show)){ //是函数 }else{ //不是函数 }

  9. Dashboard索引缺失、查询不到endpoint或counter

    触发graph的索引全量更新.补救手工操作带来的异常.触发方式为,运行curl -s "http://$hostname:$port/index/updateAll",其中$hos ...

  10. tcp_tw_recycle 的问题, 使用某一个wifi,APP老是连接不上网络

    ss -tan 反映出来的情况就是在服务器上抓包,发现有SYN包,但服务器就是不回ACK包,因为SYN包已经被丢弃了.为了验证这一结果,可以执行netstat -s | grep timestamp ...