富贵资源网 Design By www.hznty.com
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script>
 var setcookitarray = "";
 setcookitarray = "[\"http://passport.a.com/main/setCookie.do",\"http://passport.a.com/main/setCookie/main/setCookie.do",\"http://passport.a.com/main/setCookie/main/setCookie.do",\"http://passport.a.com/main/setCookie/main/setCookie.do"]";
 setcookitarray = eval(setcookitarray); 
 var setcookitarrayln = setcookitarray.length; 
 //alert(setcookitarrayln);
 var notifyurl_list=setcookitarray;
 var ll = setcookitarrayln;
 var params="yqVg1ennsNnxydEq4azcAP6TjhR90QCEUtB7gs45H08ltXBUNeoy_GczVyqC6cvZEwPGN0Al8XWKDsIt60YO1QsUlbK0Fip73Xz@7djs3ZmhBbAdanMbUH1Y@MVD2@@keR0S7njF5xiy@m6zaRWYNMbJ23jLDSrvEtMj0BExfYvFFe@twp3RHfD41dJOQzWz@nf8i@tJB12hNLIG4oW0eA==";
 var failuretime=2678400;
 var backurl="http://www.test.com";
 //alert("1111");
 
 loginALL(notifyurl_list, ll-1, backurl, params,failuretime);
 //alert("2222");
 function loginALL(notifyurl_list,num,backurl,params,failuretime) {
    var u = notifyurl_list[num];
		 alert("url:"+(num)+"-"+u);
    if (typeof u != "undefined") {
		  //alert("4444:"+notifyurl_list[num]);
      var url = notifyurl_list[num]+"&failuretime="+failuretime+"&val="+params;
			//alert("url:"+url);
			
			//动态生成script脚本标签执行url页面
			var login=request("loginScript"+num,url);
			num--;
      if (num < 0) {
				
        window.setTimeout(function() {
          window.location.href = backurl;
        }, 2000);
				
      }
			else
			{
				loginALL(notifyurl_list, num, backurl, params,failuretime);
			}
     
      
    }
 }
 
 
 
 function request(id,url){
   oScript = document.getElementById(id);
   var head = document.getElementsByTagName("head").item(0);
   if (oScript) {
    head.removeChild(oScript);
   }
   oScript = document.createElement("script");
   oScript.setAttribute("src", url);
   oScript.setAttribute("id",id);
   oScript.setAttribute("type","text/javascript");
   oScript.setAttribute("language","javascript");
   head.appendChild(oScript);
   return oScript;
}
 

</script>


<body>

</body>

主要通过 递归调用 和 动态创建script标签来实现页面的调用。

以上这篇sso跨域写cookie的一段js脚本(推荐)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

富贵资源网 Design By www.hznty.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
富贵资源网 Design By www.hznty.com