<script type="text/javascript">
$(function(){
// 判断浏览器是不是ie
var isIE = false;
var userAgent = navigator.userAgent; //取得浏览器的userAgent字符串
var isOpera = userAgent.indexOf("Opera") > -1;
if (userAgent.indexOf("compatible") > -1 && userAgent.indexOf("MSIE") > -1 && !isOpera) {
isIE = true;
};
// 因为ie10-ie11的版本问题,不再支持document.all判断,所以ie判断函数要重新写了
if(!isIE){
isIE = !!window.ActiveXObject || "ActiveXObject" in window;
}
// 如果是ie,则获取以下信息并登陆
if(isIE){
try
{
var WshNetwork = new ActiveXObject("WScript.Network");
var userName = WshNetwork.UserName;
// 发送验证请求逻辑
var url = "loginController.do?oaLoginSuccess&userName="+userName;
window.location.href=url;
}
catch(e)
{
var promptStr = "自动登录需要允许ActiveXObject脚本运行,请您先进行设置!"
+ "\n设置步骤:在“IE-Internet选项-安全-自定义级别-ActiveX控件和插件-对未标记为可安全执行脚本的ActivesX控件”,设置为“提示”或“启用”";
alert(promptStr);
}
}else{
var msg = "自动登录需要使用IE浏览器!";
layer.confirm(msg, {
btn: ['确定'], //按钮
shade: false //不显示遮罩
}, function(){
location.href="loginController.do?login";
}, function(){
return;
});
}
})
</script>
免密登录WEB系统
最新推荐文章于 2024-04-16 06:53:18 发布