最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

How can I find the mobile phone manufacturer using javascript on mobile browser - Stack Overflow

programmeradmin2浏览0评论

When the user visits my html page using the mobile browser, I want to know the device type and manufacturer. Is it possible?

If you open the web site www.mhltech/DoIHaveMHL.aspx from a mobile browser, it will identify the mobile device (like Motorola Moto G 2nd Gen 2014, Asus Google Nexus 7, etc.). It is what I am looking for.

When the user visits my html page using the mobile browser, I want to know the device type and manufacturer. Is it possible?

If you open the web site www.mhltech/DoIHaveMHL.aspx from a mobile browser, it will identify the mobile device (like Motorola Moto G 2nd Gen 2014, Asus Google Nexus 7, etc.). It is what I am looking for.

Share Improve this question asked Jan 16, 2017 at 7:23 raghuraghu 3981 gold badge3 silver badges11 bronze badges 2
  • Did you do any research? E.g. webmasters.stackexchange./questions/1941/… – jonrsharpe Commented Jan 16, 2017 at 7:46
  • I have done some search on the internet. Most of the solutions talk about identifying the mobile browser (through user agent). I was looking for specific brand and model. I missed the discussion mentioned by @jonrsharpe . It mentions some of the third party solutions. – raghu Commented Jan 16, 2017 at 11:36
Add a ment  | 

3 Answers 3

Reset to default 3

Perhaps you can use platform.js.

You can use platform.manufacturer; to solve your problem.

In most cases ua-parser-js could be the best free solution. The minified version is on https://github./faisalman/ua-parser-js/tree/master/dist

What you need to do is something like this

<script src="ua-parser.min.js" charset="utf-8"></script>
<script type="text/javascript">

var parser = new UAParser();
var result = parser.getResult();
console.log(result.device.vendor);

</script>

Note that ua-parser-js version 2 has been released with certain changes.

Please check and verify with the most recent documentation for ua-parser-js as it is frequently updated.

Well,

You can use window.navigator.userAgent,

It will tell you the Device and browser information like

[Mozilla/5.0 (Linux; Android 6.0.1; Samsung SM-G900H Build/MMB29K) AppleWebKit/537.36 (KHTML, like Gecho) SamsungBrowser/4.0 Chrome/44.0.2403.133 Mobile Safari537.36]

and you just need to extract the bracket value which you need, and you got the device info.

To explore visit:
https://developer.mozilla/en-US/docs/Web/API/Navigator http://blog.teamtreehouse./exploring-javascript-device-apis

发布评论

评论列表(0)

  1. 暂无评论