zoukankan      html  css  js  c++  java
  • 判断各平台浏览器及操作系统的方法

    //手机端判断各个平台浏览器及操作系统平台
    function checkPlatform(){
      if(/android/i.test(navigator.userAgent)){
      document.write("This is Android'browser.");//这是Android平台下浏览器
      }
      if(/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)){
      document.write("This is iOS'browser.");//这是iOS平台下浏览器
      }
      if(/Linux/i.test(navigator.userAgent)){
      document.write("This is Linux'browser.");//这是Linux平台下浏览器
      }
      if(/Linux/i.test(navigator.platform)){
      document.write("This is Linux operating system.");//这是Linux操作系统平台
      }
      if(/MicroMessenger/i.test(navigator.userAgent)){
      document.write("This is MicroMessenger'browser.");//这是微信平台下浏览器
      }
    }
      $(document).ready(function(){
      alert(navigator.platform);
      checkPlatform();
      });

     //pc端操作系统平台的判断
     document.write(navigator.platform);
  • 相关阅读:
    寒假日报day10
    寒假日报day9
    周计划06(20201026-20201101)
    周计划05(20201019-20201025)
    周总结2
    编程语言的实现模式读后感1
    软工总结
    哈夫曼编码算法
    hive表查询——排序
    假期总结4
  • 原文地址:https://www.cnblogs.com/DemoJin/p/5531041.html
Copyright © 2011-2022 走看看