Las siguientes son varias formas de obtener direcciones de URL por JS
La copia del código es la siguiente:
thisUrl = document.url;
thishref = document.location.href;
thisSloc = self.location.href;
thisDLOC = document.location;
thattloc = top.location.href;
thisPloc = parent.document.location;
thisthost = top.location.hostName;
thishost = ubicación.hostName;
tmphpage = thishref.split ("/");
thishpage = tmphpage [tmphpage.length-1];
TMPUPAGE = thisUrl.split ("/");
thisUpage = tmpupage [tmpupage.length-1];
El siguiente es el método para usar JS para obtener la dirección MAC, la dirección IP y el nombre del host:
La copia del código es la siguiente:
<html>
<Evista>
<title> </title>
<meta http-equiv = "content-type" content = "text/html; charset = gbk">
</ablo>
<Body>
<Object ClassID = "CLSID: 76A64158-CB41-11D1-8B02-00600806D9B6" ID = "Locator" style = "Display: Ninguno; Visibilidad: Hidden"> </ject>
<Object ClassID = "CLSID: 75718C9A-F029-11D1-A1AC-00C04FB6C223" ID = "foo" style = "Display: None; Visibility: Hidden"> </ject>
<form de nombre = "myform">
<br/> dirección MAC: <input type = "text" name = "macaddress">
<br/> Dirección IP: <input type = "text" name = "ipaddress">
<br/> nombre de host: <input type = "text" name = "hostname">
</form>
</body>
</html>
<script language = "javaScript">
var smacaddr = "";
var sipaddr = "";
var sdnsname = "";
servicio var = locator.connectserver ();
servicio.security_.ImmipsonationLevel = 3;
Service.instancesofasync (foo, 'win32_networkAdapterconfiguration');
</script>
<script for = "foo" event = "onobjectready (objobject, objasyncContext)" lenguaje = "jscript">
if (obJObject.IpeNabled! = NULL && objobject.Ipenable! = "Undefined" && obJObject.IpeNabled == true) {
if (obJObject.IPEnabled && objobject.ipaddress (0)! = null && objobject.ipaddress (0)! = "indefinido")
sipaddr = objobject.ipaddress (0);
if (objobject.macaddress! = null && objobject.macaddress! = "indefinido")
smacaddr = objobject.macaddress;
if (objobject.dnshostname! = null && objobject.dnshostname! = "indefinido")
sdnsname = objobject.dnshostName;
}
</script>
<script for = "foo" event = "onCompleted (HResult, PerrorObject, PasyncContext)" lenguaje = "jscript">
myForm.macaddress.value = smacaddr;
myForm.ipaddress.value = sipaddr;
myForm.hostName.Value = sdnsname;
</script>