简体   繁体   English

JavaScript-本地检测移动供应商(无jquery)

[英]JavaScript - detect mobile vendor natively (no jquery)

Is there anyway to get in javascript the mobile vendor? 无论如何,有没有使用JavaScript的移动供应商?
LG, Samsung Apple. LG,三星苹果。
Is so, is it possible to get the model? 是这样,有可能获得模型吗?
G2, Galaxy S3, Iphone5 G2,Galaxy S3,Iphone5

Thanks 谢谢

Try and fetch the User Agent using javascript and see if you can find what you are looking for 尝试使用javascript提取用户代理,然后查看是否可以找到所需的内容

navigator.userAgent

This will give you the user agent. 这将为您提供用户代理。 Once you get the user agent, you can check for some pattern in the user agent for each of the manufacturers device. 获取用户代理后,您可以在用户代理中检查每个制造商设备的某种模式。 Generally the UserAgents contains the manufacturer name in them. 通常,UserAgent在其中包含制造商名称。 Also they contain the model number in them. 它们中还包含型号。 For example, iPhone have the user agent prefix as Apple-iPhone4C1/ 例如,iPhone的用户代理前缀为Apple-iPhone4C1 /

You can google and get the list of the user agents for major manufacturers. 您可以搜索并获取主要制造商的用户代理列表。

For Apple: http://www.enterpriseios.com/wiki/Complete_List_of_iOS_User_Agent_Strings 对于苹果: http//www.enterpriseios.com/wiki/Complete_List_of_iOS_User_Agent_Strings

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM