zjunet

浏览器的版本问题自己先记一下,以后再补充:

 <script>
 if(navigator.userAgent.indexOf("Opera") != -1) {
 alert(\'Opera\');
 }
 else if(navigator.userAgent.indexOf("MSIE") != -1) {
 alert(\'Internet Explorer\');
 }
 else if(navigator.userAgent.indexOf("Firefox") != -1) {
 alert(\'Firefox\');
 }
 else if(navigator.userAgent.indexOf("Netscape") != -1) {
 alert(\'Netscape\');
 }
 else if(navigator.userAgent.indexOf("Safari") != -1) {
 alert(\'Safari\');
 }
// else{
// alert(\'无法识别的浏览器。\');
// }
 if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/6./i)=="6."){
     alert("IE 6");
 }
 else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/7./i)=="7."){
     alert("IE 7");
 }
 else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/8./i)=="8."){
     alert("IE 8");
 }
 else if(navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion.match(/9./i)=="9."){
     alert("IE 9");
 }
 </script>

分类:

技术点:

相关文章:

  • 2021-10-05
  • 2022-12-23
  • 2022-01-20
  • 2021-04-28
  • 2021-11-18
  • 2022-01-23
猜你喜欢
  • 2021-09-14
  • 2022-01-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-12
  • 2022-02-07
相关资源
相似解决方案