简体   繁体   中英

JS plugin to detect user's browser, OS, language, geolocation…?

I could have sworn that I saw this on Hacker News a few weeks ago: a simple JS plugin that gives you access to every common bit of information about your user - their OS, browser, language setting, etc.

I'm pretty sure it was a commercial product that was then immediately copied and open-sourced by someone on HackerNews.

But I now can't for the life of me remember what either the commercial product, or the open source plugin, were called.

Can anyone suggest either?

Thanks!

you can use the navigator object to accomplish most of that.

for example you can do things like this:

txt = "<p>Browser CodeName: " + navigator.appCodeName + "</p>";
txt+= "<p>Browser Name: " + navigator.appName + "</p>";
txt+= "<p>Browser Version: " + navigator.appVersion + "</p>";
txt+= "<p>Cookies Enabled: " + navigator.cookieEnabled + "</p>";
txt+= "<p>Platform: " + navigator.platform + "</p>";
txt+= "<p>User-agent header: " + navigator.userAgent + "</p>";

but the plugin you are probably looking for is Modernizr

如果您要查找统计信息而不是每个用户的特定信息,则可以使用非侵入式工具(例如Google Analytics(分析))获取有关浏览器和操作系统使用情况的数据。

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