1

I'm trying to get the client side mac address, and I tried to use node.js inner module os.networkInterfaces() to get mac address. I can compile sucessfully but I always got empty object. And I tried the both ways below:

import {networkInterfaces} from 'os';
...
const mac = networkInterfaces();

or :

const os = require('os');
const mac = os.networkInterfaces();

Does any one have similar experience? Thank you!

GoldenView
  • 57
  • 1
  • 5
  • Does this answer your question? [MAC addresses in JavaScript](https://stackoverflow.com/questions/3385/mac-addresses-in-javascript) – Matthieu Riegler Mar 07 '23 at 07:50
  • It seems there is no way. Acctually I want to bind client hardware information and the user account. So I need the web application to grab something from the browser, like hardware mac address or disc serial number. Is there anyway to do this? – GoldenView Mar 07 '23 at 08:28

1 Answers1

0

You can't use nodejs code in a browser application.

Also, a mac address is not something that is accessible within the browser, that would be a security/privacy breach.

Matthieu Riegler
  • 31,918
  • 20
  • 95
  • 134
  • Acctually I want to bind client hardware information and the user account. So I need the web application to grab something from the browser, like hardware mac address or disc serial number. Is there anyway to do this? – GoldenView Mar 07 '23 at 08:19