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

<p>Is there a way to obtain a user's MAC address using JavaScript?</p>

[{'answer_id': 3390, 'author': 'GateKiller', 'author_id': 383, 'author_profile': 'https://Stackoverflow.com/users/383', 'pm_score': 6, 'selected': False, 'text': '<p>The quick and simple answer is No.</p>\n\n<p>Javascript is quite a high level language and does not have access to this sort of information.</p>\n'}, {'answer_id': 3398, 'author': 'Ryan Ahearn', 'author_id': 75, 'author_profile': 'https://Stackoverflow.com/users/75', 'pm_score': 3, 'selected': False, 'text': '<p>If this is for an intranet application and all of the clients use DHCP, you can query the DHCP server for the MAC address for a given IP address.</p>\n'}, {'answer_id': 3560, 'author': 'Seibar', 'author_id': 357, 'author_profile': 'https://Stackoverflow.com/users/357', 'pm_score': 3, 'selected': False, 'text': "<p>Nope. The reason ActiveX can do it is because ActiveX is a little application that runs on the client's machine.</p>\n\n<p>I would imagine access to such information via JavaScript would be a security vulnerability.</p>\n"}, {'answer_id': 7923, 'author': 'Vincent Robert', 'author_id': 268, 'author_profile': 'https://Stackoverflow.com/users/268', 'pm_score': 5, 'selected': False, 'text': '<p>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.</p>\n\n<p>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.</p>\n\n<p>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).</p>\n'}, {'answer_id': 10747, 'author': 'Grey Panther', 'author_id': 1265, 'author_profile': 'https://Stackoverflow.com/users/1265', 'pm_score': 7, 'selected': True, 'text': '<p>I concur with all the previous answers that it would be a privacy/security vulnerability if you would be able to do this directly from Javascript. There are two things I can think of:</p>\n\n<ul>\n<li>Using Java (with a signed applet)</li>\n<li>Using signed Javascript, which in FF (and Mozilla in general) gets higher privileges than normal JS (but it is fairly complicated to set up)</li>\n</ul>\n'}, {'answer_id': 48112607, 'author': 'Ad Kahn', 'author_id': 2855519, 'author_profile': 'https://Stackoverflow.com/users/2855519', 'pm_score': 3, 'selected': False, 'text': '<p>i was looking for the same problem and stumbled upon the following code.</p>\n\n<p>How to get Client MAC address(Web):</p>\n\n<p>To get the client MAC address only way we can rely on JavaScript and Active X control of Microsoft.It is only work in IE if Active X enable for IE. As the ActiveXObject is not available with the Firefox, its not working with the firefox and is working fine in IE.</p>\n\n<p>This script is for IE only:</p>\n\n<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">\r\n<div class="snippet-code">\r\n<pre class="snippet-code-js lang-js prettyprint-override"><code>function showMacAddress() {\r\n    var obj = new ActiveXObject("WbemScripting.SWbemLocator");\r\n    var s = obj.ConnectServer(".");\r\n    var properties = s.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration");\r\n    var e = new Enumerator(properties);\r\n    var output;\r\n    output = \'&lt;table border="0" cellPadding="5px" cellSpacing="1px" bgColor="#CCCCCC"&gt;\';\r\n    output = output + \'&lt;tr bgColor="#EAEAEA"&gt;&lt;td&gt;Caption&lt;/td&gt;&lt;td&gt;MACAddress&lt;/td&gt;&lt;/tr&gt;\';\r\n    while (!e.atEnd()) {\r\n        e.moveNext();\r\n        var p = e.item();\r\n        if (!p) continue;\r\n        output = output + \'&lt;tr bgColor="#FFFFFF"&gt;\';\r\n        output = output + \'&lt;td&gt;\' + p.Caption; +\'&lt;/td&gt;\';\r\n        output = output + \'&lt;td&gt;\' + p.MACAddress + \'&lt;/td&gt;\';\r\n        output = output + \'&lt;/tr&gt;\';\r\n    }\r\n    output = output + \'&lt;/table&gt;\';\r\n    document.getElementById("box").innerHTML = output;\r\n}\r\n\r\nshowMacAddress();</code></pre>\r\n<pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;div id=\'box\'&gt;&lt;/div&gt;</code></pre>\r\n</div>\r\n</div>\r\n</p>\n'}, {'answer_id': 70927558, 'author': 'بدور فهد', 'author_id': 18081838, 'author_profile': 'https://Stackoverflow.com/users/18081838', 'pm_score': -1, 'selected': False, 'text': "<p>No you can't obtain a user's MAC address using JavaScript in another way, just by using  active X op for Microsoft in IE browser</p>\n"}, {'answer_id': 73131819, 'author': 'hasherfer', 'author_id': 5339177, 'author_profile': 'https://Stackoverflow.com/users/5339177', 'pm_score': 0, 'selected': False, 'text': "<p>I know I am really late to this party. And although the answer is still no. I found a way to generate and store a unique id that helps to keep track of a user while they navigate the site.</p>\n<p>When the user signs up, I then have a full record of what pages he visited before he signed up. I also store this id in the user table for historical reference.</p>\n<p>This is also handy when you're looking for dubious activity. For example, a user that has created multiple accounts. I should note that this is on a financial transaction site and the data is only used internally. It does really help to cut down on fraudulent and duped accounts. There is a lot that can be done with localStorage and this method, but I will keep this short to not give anyone nefarious ideas.</p>\n<p>1- Generate a random string. If you generate a 40 char string, you don't really have too much to worry about as far as them colliding. We're not looking to send a rocket to Mars here.</p>\n<p>I use a small PHP function to generate a 40 char string. I use Ajax to call this function and retrieve the result.</p>\n<pre><code>    function genrandstr($length=NULL) {\n        if($length == NULL){ $length = 30; }\n        $characters = \n        '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';\n        $charactersLength = strlen($characters);\n        $randomString = '';\n        for ($i = 0; $i &lt; $length; $i++) {\n        $randomString .= $characters[rand(0, $charactersLength - 1)];\n    }\n        return $randomString;\n    }\n\n    localStorage.setItem('id', id) to add to localStorage\n    (let) or (var) id = localStorage.getItem('id') to read from localStorage\n</code></pre>\n<p>2- Using cookies, you can store this id in a cookie.</p>\n<p>3- LocalStorage is your friend. Store the same id in LocalStorage and chances are, you will always have that id to look at.</p>\n<p>With an id stored in LocalStorage, your user can delete cookies and you'd still be able to recognize an old visitor by this id.</p>\n<p>If the user deletes all their data, then you're SOL and start all over again when they revisit.</p>\n<p>Have Fun</p>\n"}]
['https://Stackoverflow.com/questions/3385', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/384/']