NorthHarbor
  • 检测是否在客户端App内
function is_app() {
    var userAgent = navigator.userAgent.toLowerCase();//获取UA信息
    if (userAgent.indexOf("xxxxxx") != -1) {    //判断ua中是否含有和app端约定好的标识xxxxxx
        return true  // 在app内
    } else {
        return false  // 不在 app 内
    }
}
  • 检测是否在Android内
function isAndroid() {
    const userAgent = navigator.userAgent;
    return userAgent.indexOf(\'Android\') > 0;
},
  • 检测是否在IOS内
function isAndroid() {
    const userAgent = navigator.userAgent;
    return /(iPhone|iPad|iPod)/i.test(userAgent);
},

分类:

技术点:

相关文章:

  • 2021-09-17
  • 2021-09-17
  • 2022-01-20
  • 2022-01-22
  • 2021-09-30
  • 2021-12-23
  • 2021-07-30
  • 2021-12-23
猜你喜欢
  • 2021-05-23
  • 2021-09-27
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-24
  • 2021-07-06
相关资源
相似解决方案