Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 649
michele b Avatar asked Mar 21 '13 17:03

michele b


People also ask

How does Google get device name?

So it looks like because you're logged into Google Chrome, Google knows your computer name. Note that Google using a sandbox does not make any difference for this. It is trivial to find your computer name, all it takes is hostname in a command prompt.

What is the ID of a chrome extension?

Open the Chrome Web Store. Find and select the app or extension you want. Look at the URL. The ID is the long string of characters at the end of the URL.

Is Google com a hostname?

www.google.com and google.com are two different hostnames. They have different A records in DNS and they can have different IP addresses, or multiple IP addresses assigned to them. There is no rule that www and non-www hostnames need to go to the same server or IP.


2 Answers

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.

like image 71
sowbug Avatar answered Sep 21 '22 07:09

sowbug


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!

like image 37
Pudica Avatar answered Sep 19 '22 07:09

Pudica