<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript">
//获取浏览器 基础参数 alert测试用
var brower = navigator.userAgent;
//常规代码 判断 其他浏览器
var Sys={};
var ua=navigator.userAgent.toLowerCase();
var s;
(s=ua.match(/msie ([\d.]+)/))?Sys.ie=s[1]:
(s=ua.match(/firefox\/([\d.]+)/))?Sys.firefox=s[1]:
(s=ua.match(/chrome\/([\d.]+)/))?Sys.chrome=s[1]:
(s=ua.match(/opera.([\d.]+)/))?Sys.opera=s[1]:
(s=ua.match(/version\/([\d.]+).*safari/))?Sys.safari=s[1]:0;
if(Sys.ie){//Js判断为IE浏览器
alert('您使用的是IE/360浏览器 注册请使用火狐 谷歌 等浏览器'+Sys.ie);
if(Sys.ie=='11.0'){//Js判断为IE 9
}else if(Sys.ie=='8.0'){//Js判断为IE 8
}else{
}
}
if(Sys.firefox){//Js判断为火狐(firefox)浏览器
//alert('http://www.phpernote.com'+Sys.firefox);
}
if(Sys.chrome){//Js判断为谷歌chrome浏览器
//alert('http://www.phpernote.com'+Sys.chrome);
}
if(Sys.opera){//Js判断为opera浏览器
//alert('http://www.phpernote.com'+Sys.opera);
}
if(Sys.safari){//Js判断为苹果safari浏览器
//alert('http://www.phpernote.com'+Sys.safari);
}
//常规代码 判断其他浏览器
//判断IE 11
if(!!window.ActiveXObject || "ActiveXObject" in window)
alert('您使用的是IE/360浏览器 注册请使用火狐 谷歌 等浏览器');
else
alert('False');
// alert(brower.toLowerCase());
// alert("alert");
有取消按钮
confirm("Confirm 有取消按钮的弹出框");
//弹出输入框
prompt("prompt 弹出输入框");
//未知
document.write("document.write html文本");
//写入控制台 F12 查看
console.log("console.log 在F12 控制台查看");
</script>
</head>
<body>
<input type="button" onclick="display_alert()"
value="浏览器类型检测 " />
<h2>浏览器检测和 多种弹出框JS,20200519搞定:1 上传图片功能修改一下路径搞定; </h2>
<h2> 2 图片验证码功能修改this.host 或者直接在url去掉 this.host 搞定。</h2>
<h2> 3 注册功能再试使用浏览器检测搞定 后期再看是深入 VUE 还是 DIY JS。</h2>
<h2>浏览器判断参考网址:http://www.daimajiayuan.com/sitejs-17174-1.html</h2>
<h2>IE11判断参考网址:https://blog.csdn.net/whupanyinghua/article/details/38026027</h2>
<h2>alert参考网址:https://blog.csdn.net/qq_39822451/article/details/82753858</h2>
</body>
<script type="text/javascript">
function display_alert()
{
var brower = navigator.userAgent;
var ua=navigator.userAgent.toLowerCase();
alert(brower)
confirm(ua)
}
</script>
</html>