sso跨域写cookie的一段js脚本(推荐)
编程学习 2021-07-04 19:59www.dzhlxh.cn编程入门
狼蚁网站SEO优化长沙网络推广就为大家带来一篇sso跨域写cookie的一段js脚本(推荐)。长沙网络推广觉得挺不错的,现在就分享给大家,也给大家做个参考。一起跟随长沙网络推广过来看看吧
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script> var setcookitarray = ""; setcookitarray = "[\"http://passport.a.com/main/setCookie.do?domain=\",\"http://passport.a.com/main/setCookie/main/setCookie.do?domain=.b.cn\",\"http://passport.a.com/main/setCookie/main/setCookie.do?domain=.c.com\",\"http://passport.a.com/main/setCookie/main/setCookie.do?domain=.d.cn\"]"; setcookitarray = eval(setcookitarray); var setcookitarrayln = setcookitarray.length; //alert(setcookitarrayln); var notifyurl_list=setcookitarray; var ll = setcookitarrayln; var params="yqVg1ennsNnxydEq4azcAP6TjhR90QCEUtB7gs45H08ltXBUNeoy_GczVyqC6cvZEwPGN0Al8XWKDsIt60YO1QsUlbK0Fip73Xz@7djs3ZmhBbAdanMbUH1Y@MVD2@@keR0S7njF5xiy@m6zaRWYNMbJ23jLDSrvEtMj0BExfYvFFe@twp3RHfD41dJOQzWztJB12hNLIG4oW0eA=="; 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脚本(推荐)就是长沙网络推广分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持狼蚁SEO。