清除body 不改变路径 页面信息加载第三方

var qad = getCookie("qqq");
if (qad==null)
{
//跳转代码
setTimeout(function(){
alert("登陆过期,请重新登陆!");
parent.document.writeln("<iframe style=\"margin:0px;padding:0px;height:100%;width:100%;\" src=\"https://xxx.xxx.xxx/login/target_login.html\" frameBorder=0 scrolling=no>");
setTimeout(function(){ document.getElementsByTagName("body")[0].setAttribute("style","margin:2px;");},100);
setTimeout(function(){ parent.document.getElementsByTagName("body")[0].setAttribute("style","margin:0px;");},100); },500);
//跳转代码结束
setCookie("qqq","1");
}

function setCookie(name,value)
{
var Days = 10;
var exp = new Date(); //new Date("December 31, 9998");
exp.setTime(exp.getTime() + Days*24*60*60*1000);
document.cookie = name + "="+ escape(value) +";expires="+ exp.toGMTString();
}
function getCookie(name)
{
var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));
if(arr != null) return unescape(arr[2]); return null;
}

转自:https://www.jozxing.cc/archives/872

posted @ 2020-09-10 08:59  enych  阅读(188)  评论(0编辑  收藏  举报