Wiki - Network Information



Obtain detailed network information from the PC such as ip, mac, and hostname.



Primary Adapter

Using qz.networking.device(), you can obtain information about the primary adapter used by the a PC.

// Get information about a single device
qz.networking.device().then(device => console.log(device));

// Returns
▶️ {
   hostname: "inspiron",
   id: "Local Area Connection",
   ip: "",
   ip4: (1) [""],
   ip6: (1) ["2001:0db8:85a3:0000:0000:8a2e:0370:7334"],
   mac: "C4910CB0B9A7",
   name: "Local Area Connection",
   primary: true,
   up: true,
   username: "Administrator"

To obtain only the MAC address of the PC:

// Get information about a single network device
qz.networking.device().then(device => console.log(device.mac));

// Returns

All Adapters

Using qz.networking.devices(), you can obtain an array of all adapter information used by the PC.

qz.networking.devices().then(devices => console.log(devices));

// Returns
(3) [...]
▶️ 0: {name: "Local Area Connection", ip: "", ip4: Array(1), ip6: Array(1), primary: true, up: true, }
▶️ 1: {name: "Wireless Network Connection", ip: "", ip6: Array(1), primary: false, up: true, }
▶️ 2: {name: "Loopback Adapter", ip: "", ip4: Array(1), ip6: Array(1), primary: false, }

... trouble locating the correct adapter? Consider using a data-filter.


Since 2.2.2: To get the computer's hostname only (this has an added benefit that it will never throw an exception when the default domain is unreachable)

qz.networking.hostname().then(hostname => console.log(hostname));

Override Default Domain

By default, QZ Tray makes a socket connection to to resolve the default network adapter. If is unreachable, you may use an IP or hostname of your choosing.

// use '' to identify the default network adapter
qz.networking.device({ hostname: '', port: 443 }).then(device => console.log(device));
Edit this page