主流app的userAgent

开发过程中遇到了,记录一下

const ua = navigator.userAgent.toLowerCase()

微信

mozilla/5.0 (iphone; cpu iphone os 17_2_1 like mac os x) applewebkit/605.1.15 (khtml, like gecko) mobile/15e148 micromessenger/8.0.46(0x18002e2b) nettype/wifi language/zh_cn

ua.includes('micromessenger')

小程序

mozilla/5.0 (iphone; cpu iphone os 11_0 like mac os x) applewebkit/604.1.38 (khtml, like gecko) version/11.0 mobile/15a372 safari/604.1 wechatdevtools/1.06.2401020 micromessenger/8.0.5 language/zh_cn webview/22415_6 webdebugger miniprogramhtmlwebview miniprogram

ua.includes('miniprogram')

微博

mozilla/5.0 (iphone; cpu iphone os 17_2_1 like mac os x) applewebkit/605.1.15 (khtml, like gecko) mobile/15e148 weibo (iphone16,1__weibo__14.1.1__iphone__os17.2.1)

ua.includes('weibo')

抖音

mozilla/5.0 (iphone; cpu iphone os 17_2_1 like mac os x) applewebkit/605.1.15 (khtml, like gecko) mobile/15e148 aweme_28.4.0 region/-- apptheme/light nettype/wifi jssdk/2.0 channel/app bytelocale/zh bytefulllocale/zh-hans-cn bullettag/ wkwebview/1 bullet/1 aweme/28.4.0 bytedancewebview/d8a21c6 falcontag

ua.includes('bytedance')

飞书

Mozilla/5.0 (Linux; Android 9; MI 6X Build/PKQ1.180904.001; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/75.0.3770.156 Mobile Safari/537.36 Lark/5.10.4 LarkLocale/zh_CN ChannelName/Feishu TTWebView/0751130016452

ua.includes('feishu')

注意

小红书客户端做了白名单机制,拿不到ua也打开不了其他页面

  • 4
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值