How do you get the device name (or hostname) from a Chrome Extension?

北城余情 提交于 2019-11-29 07:30:44

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.

Edit: 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.

Yes. Since Chrome version 43, released a while after the question and other answer here, you can get a unique device ID in a Chrome extension with chrome.instanceID.getID().

The device names in the Other Devices menu (chrome://history/syncedTabs) can be found with chrome.sessions.getDevices() but it only includes all your other devices, not the current one!

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!