zoukankan      html  css  js  c++  java
  • 【原创】SSO-Javascript模拟IE登录,不让IIS弹出登录窗口

    解决方案:

    用JS模拟IE用户登录,再跳转到对应的系统。
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    <script type="text/javascript" language="javascript">
        function Authen() {
                var Location1 = "http://bi.xxx.com"; //定义你的路径 
     
                var auth = null;
                if (window.XMLHttpRequest)
                {
                    auth = new XMLHttpRequest();
                } else if (window.ActiveXObject)
                {
                    auth = new ActiveXObject("msxml2.xmlhttp"); //创建msxml2.xmlhttp对象
                }
     
                //var auth = new ActiveXObject("MSXML2.XMLHTTP.6.0"); //如需要,分浏览器判断创建对象
                //var auth = new ActiveXObject("MSXML2.XMLHTTP.5.0");
     
                auth.open("get", Location1, false, "用户名", "密码");
                auth.send();
     
                switch (auth.status) { //检测auth.send以后的状态,
                    case 200: //状态为:200代表用户名密码正确, 
                        window.location.href = Location1; //浏览器重转向
                        break;
                    case 401: //状态为:401代表用户名密码不正确,身份验证错误 
                        alert("用户无效或密码错误。"); //报错 
                        break;
                    default: //其它状态,如服务器无法访问 
                        alert(auth.status);
                        alert("对不起,服务器发生错误,请稍后再试!"); //报错 
                }
            }
    </script>
    </head>
     
    <body>
        <input type="button" onclick="Authen();" value="登  录"></input>
    </body>
    </html>
  • 相关阅读:
    群资料共享
    python 智能合约日志操作
    canvas绘制图片
    rgb随机变色
    直接用css生成三角形的问题
    纯css三层侧边栏效果
    清除浮动终极版本
    懒加载
    html5可以通用的几段代码
    jquery中animate()动画方法
  • 原文地址:https://www.cnblogs.com/xiongnanbin/p/542843089ac49ad60dc61e5e360d204f.html
Copyright © 2011-2022 走看看