MAC addresses in JavaScript

前端 未结 6 1965
抹茶落季
抹茶落季 2020-11-22 06:14

I know that we can get the MAC address of a user via IE (ActiveX objects).

Is there a way to obtain a user\'s MAC address using JavaScript?

6条回答
  •  旧时难觅i
    2020-11-22 06:34

    No you cannot get the MAC address in JavaScript, mainly because the MAC address uniquely identifies the running computer so it would be a security vulnerability.

    Now if all you need is a unique identifier, I suggest you create one yourself using some cryptographic algorithm and store it in a cookie.

    If you really need to know the MAC address of the computer AND you are developing for internal applications, then I suggest you use an external component to do that: ActiveX for IE, XPCOM for Firefox (installed as an extension).

提交回复
热议问题