What are available solutions of a browser / mobile phone detection

后端 未结 3 853
逝去的感伤
逝去的感伤 2020-12-05 05:59

I am creating a phonegap application for various mobile platforms and I was wondering what is a current best solution of browser/mobile phone detection?

Should I go

3条回答
  •  时光取名叫无心
    2020-12-05 06:42

    This may not be the best solution but i use this function for my personal use in javascript.

    By the way @Gajotres thanks for deep and useful information.

    function mobilMi()
    {
      if( navigator.userAgent.match(/Android/i) ||
       navigator.userAgent.match(/webOS/i) ||
       navigator.userAgent.match(/iPhone/i) ||
       navigator.userAgent.match(/iPod/i)||
       navigator.userAgent.match(/iPad/i)
       ){
        return 1;
      }
      else
       return 0;
    }
    

提交回复
热议问题