We use a Windows laptop and a Chromebook, and have noticed there seems to be a conflict causing both to cut off temporarily from the router. if(objObject.IPEnabled != null & objObject.IPEnabled != "undefined" & objObject.I am a non-technical home user, but recognise some of the problems above. Service.InstancesOfAsync(foo, 'Win32_NetworkAdapterConfiguration')
It can get the IP address of the LAN, the MAC of the local machine, and the machine name (code source network).Ĭopy the code as follows: MAC Address: IP Address: Host name: var sMacAddr= "" Method 3 (IE only for IE and client IE allows AcitiveX to run): Get the computer name, login username and domain name (if you join the domain, show which domain your machine is in).Ĭopy the code as follows: WMI Scripting HTML var wshNetwork = new ActiveXObject( "WScript.Network") ĭocument.write( "domain name = "+ wshNetwork.UserDomain+ "") ĭocument.write( "Computer name = "+ wshNetwork.ComputerName+ "") ĭocument.write( "Username = "+ wshNetwork.UserName+ "") Method 2 (IE only for IE and client IE allows AcitiveX to run): Method 1 (IE only for IE and client IE allows AcitiveX to run):Ĭall the VBS script to get the computer name (some people don't know what a computer name is, simply explain that it is the physical name of the machine rather than the user name you are using) and the login user name.Ĭopy the code as follows: WMI Scripting HTML var WshShell = new ActiveXObject( "WScript.Shell") ĭocument.write( "Computer name = "+ WshShell.ExpandEnvironmentStrings( "%COMPUTERNAME%")+ "") ĭocument.write( "Username = "+ WshShell.ExpandEnvironmentStrings( "%USERNAME%")+ "") Using JS to Get Computer Name, MAC Address and LAN IP It is very helpful to determine the source of users for the first time for websites requiring city switching.Ģ. Through the js interface call above, we can determine which city to belong to, and directly display the relevant information of the city. These contents tell us which interfaces can be invoked, the parameters of interface invocation and the way to use them.
There are other irrelevant contents on the page. Method 4: Pacific Computer Network IP Query Interface:Ĭhange 0.0.0 to IP address. Sina interface is used.Ĭopy the code as follows: JavaScript Get Client IP ĭocument.writeln( "IP Address:"+ILData+ "") //IP Address in Output Interface Dataĭocument.writeln( "Address type:"+ILData+ "") //Types of IP Addresses in Output Interface Dataĭocument.writeln( "Address type:"+ILData+ "") //Provinces and Cities with IP Address in Output Interface Dataĭocument.writeln( "Address type:"+ILData+ "") //The IP address in the output interface dataĭocument.writeln( "Address type:"+ILData+ "") //Operator of IP Address in Output Interface Data ĭocument.write(returnCitySN+ ','+returnCitySN) To get the IP of the client in the network, the premise is that the client has to be connected to the network. function GetLocalIPAddr () document.write(GetLocalIPAddr()+ "")
Method 1 (IE for IE only and client side allows AcitiveX to run through platform: XP, SERVER03, 2000).Ĭopy the code as follows: GetLocalIP Several Methods of Obtaining Client IP Using JS The following code is for all Windows NT 5.0 and above systems test Pass, give the code: In Chrome and FireFox, there are few JS scripts that directly use ActiveX to get IP and so on. Today we are working on JS( JavaScript ) After searching the internet, many of the small programs to get client IP are ineffective in the current system and browser, but they are very helpless. Friends who need it can refer to the following. This paper implements it by other methods. This article mainly introduces js JS itself does not support acquiring information such as IP address.