Getting the MAC address of a client with a browser

I have the following problem: I have a web server. This web server is located behind the router. The problem is that I need the MAC address of the client, which opens the website on the server for further purposes. I already tried to get the MAC address through ActiveX-Object, but the client needs to install WMI. Here is the actual code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <html> <head> <title></title> <meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1"> <meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5"> <script id="clientEventHandlersJS" language="javascript"> function Button1_onclick() { var locator = new ActiveXObject("WbemScripting.SWbemLocator"); var service = locator.ConnectServer("."); var properties = service.ExecQuery("SELECT * FROM Win32_NetworkAdapterConfiguration"); var e = new Enumerator (properties); document.write("<table border=1>"); dispHeading(); for (;!e.atEnd();e.moveNext ()) { var p = e.item (); document.write("<tr>"); document.write("<td>" + p.Caption + "</td>"); document.write("<td>" + p.IPFilterSecurityEnabled + "</td>"); document.write("<td>" + p.IPPortSecurityEnabled + "</td>"); document.write("<td>" + p.IPXAddress + "</td>"); document.write("<td>" + p.IPXEnabled + "</td>"); document.write("<td>" + p.IPXNetworkNumber + "</td>"); document.write("<td>" + p.MACAddress + "</td>"); document.write("<td>" + p.WINSPrimaryServer + "</td>"); document.write("<td>" + p.WINSSecondaryServer + "</td>"); document.write("</tr>"); } document.write("</table>"); } function dispHeading() { document.write("<thead>"); document.write("<td>Caption</td>"); document.write("<td>IPFilterSecurityEnabled</td>"); document.write("<td>IPPortSecurityEnabled</td>"); document.write("<td>IPXAddress</td>"); document.write("<td>IPXEnabled</td>"); document.write("<td>IPXNetworkNumber</td>"); document.write("<td>MACAddress</td>"); document.write("<td>WINSPrimaryServer</td>"); document.write("<td>WINSSecondaryServer</td>"); document.write("</thead>"); } </script> </head> <body> <INPUT id="Button1" type="button" value="Button" name="Button1" language="javascript" onclick="return Button1_onclick()"> </body> 

When you click on the button, it should return a table with network configuration, but this does not work for me. I would like to know if there is another solution for getting the client MAC address through the browser. I also do not want to limit use in Internet Explorer. Thanks in advance for your help.

Regards, Chris

+8
browser mac-address client
source share
2 answers

It seems that you can do this with a Java applet, see postst at https://forums.oracle.com/forums/thread.jspa?threadID=1144276 and http://techdetails.agwego.com/2008/02 / 11/37 / .

Not sure if you need the user to agree to a security warning for this or not, I have not tried.

There is probably no better way, since ActiveX will only work on Windows (and only IE), and there is no such API to get the MAC address in any standard HTML or JavaScript. I do not know if Flash can be useful for this, but I doubt it.

However, your reason for getting the user's MAC address may seem valid, but I still think that it is not recommended to display any information because it can be tampered with / changed and may not be displayed properly in certain situations. You would do better if you could find the best solution for your problem (apart from capturing MAC addresses).

+5
source share

In my previous project. we used websocket in a javascript browser to communicate with native code, C # dll, running on the same computer. Native code can retrieve any system information, MAC address and other system information, such as memeory, disk space, etc. Node.js can be used to replace C #, as well as to interrupt the restriction of processing windows and MAC machines. The entire application (chrome browser + native code) was downloaded to the client using the installation screen.

-2
source share

All Articles