admin管理员组

文章数量:1530844

判断当前浏览器版本ie浏览器跳转谷歌浏览器

在 vue 项目 index.html中 添加
function getOs() {
if (navigator.userAgent.indexOf(“MSIE”) != -1) {
//跳转对应的 html页面
// window.location.replace(“file:///D:/work/wzs-jgyyfx-manage/static/login.html”)
window.location.href = “./static/login.html”
return “MSIE”
}
if (navigator.userAgent.indexOf(“Firefox”) != -1) {
return “Firefox”
}
if (navigator.userAgent.indexOf(“Chrome”) != -1) {
// window.location.href = “./static/login.html”
return “Chrome”
}
if (navigator.userAgent.indexOf(“Safari”) != -1) {
return “Safari”
}
if (navigator.userAgent.indexOf(“Opera”) != -1) {
return “Opera”
}
}

判断浏览器类型 如果是ie浏览器 重定向到 html 页面

(ie 浏览器 要进行设置 // ie 浏览器 设置 internet选项 安全 自定义级别 XAML浏览器应用程序 全部启用 )

在 html 页面 点击打开谷歌浏览器
//ActiveXObject 这个对象只有在 ie浏览器下面才能创建 否则会 报错
var objshell = new ActiveXObject(“WScript.Shell”);
objshell.Run(“cmd.exe /c start chrome http://localhost:8001/#/login”, 0, true)

本文标签: 浏览器跳转版本