判断是什么设备或app内打开还是浏览器打开

判断是ios还是Android const uanavigator.userAgent.toLowerCase()let isiOSfalseif(!!u.match((i[^;];( U;)? CPU.Mac OS X)){

判断是ios还是Android

	const ua = navigator.userAgent.toLowerCase()
	let isiOS = false
	if(!!u.match(/\(i[^;]+;( U;)? CPU.+Mac OS X/)){//是ios
		isiOS = true
	}else{
		isiOS = false
	}

判断是微信还是钉钉

	const ua = navigator.userAgent.toLowerCase()
	let isWeiXin = false
	let isDingTalk = false
	if(ua.match(/DingTalk/i)=="dingtalk"){//用钉钉打开
		isDingTalk = true
	}else if(ua.match(/MicroMessenger/i)=="micromessenger"){//用微信打开
		isWeiXin = true
	}else{//用其他浏览器打开
	
	}

发布者:admin,转转请注明出处:http://www.yc00.com/web/1743813859a4511534.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信