标签搜索

Javascript 判断是否移动端

sunshine
2023-07-13 / 0 评论 / 56 阅读
温馨提示:
本文最后更新于2023年07月13日,已超过422天没有更新,若内容或图片失效,请留言反馈。
function isMobile() {
  var ua = navigator.userAgent;
  var ipad = ua.match(/(iPad).*OS\s([\d_]+)/),
  isIphone = !ipad && ua.match(/(iPhone\sOS)\s([\d_]+)/),
  isAndroid = ua.match(/(Android)\s+([\d.]+)/);
  return isIphone || isAndroid;
}
感觉很棒,欢迎点赞 OR 打赏~
1
分享到:

评论 (0)

取消