如何从Chrome扩展程序获取设备名称(或主机名称)? [英] How do you get the device name (or hostname) from a Chrome Extension?

查看:557
本文介绍了如何从Chrome扩展程序获取设备名称(或主机名称)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法从Chrome扩展程序中检索设备名称?

Is there a way to retrieve the device name from a Chrome Extension?

理想情况下,我希望获得显示在其他设备'在新标签页上的菜单...是否有这些信息可用于扩展?

Ideally I'd like to get the same String that is displayed in the 'Other devices' menu on the new tab page... Is that piece of information available to extensions?

或者,主机名是否可用?

Alternatively, is the hostname available?

我设法通过访问 window.navigator.userAgent 获得用户代理,但就是这样...

What I managed to get is the user-agent by accessing window.navigator.userAgent, but that's it...

推荐答案

没有。与用户硬件相关的持久唯一标识符基本上是一个不可删除的cookie。出于隐私原因,浏览器(和浏览器扩展API)不提供这样的标识符。

No. A persistent and unique identifier associated with the user's hardware would basically be an undeletable cookie. For privacy reasons, browsers (and browser-extension APIs) don't provide such identifiers.

编辑:来自experimental.systemInfo。*您可能能够构建一些将描述有关用户系统的某些属性。例如,保证下拉菜单中的唯一性不足以保证其独特性,但它可能是朝着正确方向迈出的一步。请注意,这些API是实验性的,因此您无法通过网上商店分发扩展程序。

from experimental.systemInfo.* you might be able to construct something that will describe certain attributes about the user's system. It won't be distinctive enough to guarantee uniqueness in a dropdown menu, for example, but it might be a step in the right direction. Note that these APIs are experimental so you won't be able to distribute extensions using them through the web store.

这篇关于如何从Chrome扩展程序获取设备名称(或主机名称)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆