zoukankan      html  css  js  c++  java
  • Detecting iOS

    Detecting iOS

    I am not a fan of User Agent sniffing, but here is how you would do it:

    var iOS = /iPad|iPhone|iPod/.test(navigator.platform);

    Another way, relying on the userAgent:

    var iOS = /iPad|iPhone|iPod/.test(navigator.userAgent) && !window.MSStream;

    iOS will be either true or false

    Why not MSStream

    Microsoft injected the word iPhone in IE11's userAgent in order to try and fool Gmail somehow. Therefore we need to exclude it. More info about this here and here.

    Below is IE11's updated userAgent (Internet Explorer for Windows Phone 8.1 Update):

    Mozilla/5.0 (Mobile; Windows Phone 8.1; Android 4.0; ARM; Trident/7.0; Touch; rv:11.0; IEMobile/11.0; NOKIA; Lumia 930) like iPhone OS 7_0_3 Mac OS X AppleWebKit/537 (KHTML, like Gecko) Mobile Safari/537

  • 相关阅读:
    MongoDB
    Flask-Migrate
    Flask-Script
    Flask-SQLAlchemy
    SQLAlchemy
    DBUtils
    依存句法分析
    如何将本地的jar包上传到maven本地仓库中
    git使用手册
    中文网页编解码问题
  • 原文地址:https://www.cnblogs.com/sban/p/4809739.html
Copyright © 2011-2022 走看看