var ua = navigator.userAgent.toLowerCase(); var Android = String(ua.match(/android/i)) == "android"; var iPad = String(ua.match(/ipad/i)) == "ipad"; var iPhone = String(ua.match(/iphone/i)) == "iphone"; var url = window.locat…
很多Android开发者或者网站端都可能会困扰关于如何区分Android phone和Android Pad的ua.确实这个问题很困难,我也曾被困扰了一段时间,后来在Stackoverflow中发现了解决方法. 答案: Mobile Android has “mobile” in the User-agent. Tablet Android does not. 详细英文解释: Here’s a trending User-Agent detection misstep we hope to he…