简体   繁体   English

JS插件检测用户的浏览器,操作系统,语言,地理位置......?

[英]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. 我可能发誓几周前就在Hacker News上看到了这一消息:一个简单的JS插件,可让您访问有关用户的所有常见信息-用户的操作系统,浏览器,语言设置等。

I'm pretty sure it was a commercial product that was then immediately copied and open-sourced by someone on HackerNews. 我很确定它是一种商业产品,然后立即被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 但是您可能正在寻找的插件是Modernizr

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

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

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