简体   繁体   中英

Is there any way to detect a user's Mac hardware model from the browser?

I wanted to see if anyone knows if it's possible to detect what Mac computer model a user is has, straight from the browser. Aka "MacBook Pro (Mid/Late 2007)" or "MacBook Air (Late 2008 or newer)."

This is probably a long shot, but since Mac browsers provide the OS via userAgent (http://www.quirksmode.org/js/detect.html), I thought there could be a chance.

Nope. The User-Agent header provides some information, but not much:

Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11

You can test this yourself by going to http://whatsmyuseragent.com/ , or dumping the User-Agent header in your favorite server-side language.

Similar information can be found in the navigator object from JavaScript:

appCodeName: "Mozilla"
appName: "Netscape"
appVersion: "5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11"
cookieEnabled: true
geolocation: Geolocation
language: "en-US"
mimeTypes: MimeTypeArray
onLine: true
platform: "MacIntel"
plugins: PluginArray
product: "Gecko"
productSub: "20030107"
userAgent: "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11"
vendor: "Google Inc."
vendorSub: ""
__proto__: Navigator

The only way to get more information is from a browser plugin of some kind.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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