Search code examples
google-chromegoogle-chrome-extensiongoogle-chrome-app

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


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?

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


Solution

  • 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.