Detect IP address and hostname
Detect IP address and hostname
AI
AI சுருக்கம்: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
மூலக் குறியீடு
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Detect IP address and hostname</title>
</head>
<body>
<BODY>
<!-- Script by Jayant Kumar Gandhi - www.jayantgandhi.com -->
<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
// detect whether IE or netscape
netscapeTest = parseInt(navigator.appVersion)
explorerTest = navigator.appName.indexOf("Microsoft") + 1
// detect hostname for Netscape 3
function netscapeThree() {
if (navigator.javaEnabled()) {
userDomain = java.net.InetAddress.getLocalHostName()
return (userDomain.toString())
} else {
return null
}
}
// detect hostname and IP address for Netscape 4
// Note here baseaddress is in format 'hostname/ip-address'
// getHostName() gets us the host name
function netscapeFour() {
if (navigator.javaEnabled()) {
baseAddress = java.net.InetAddress.getLocalHost()
userDomain = baseAddress.getHostName()
return (userDomain.toString())
} else {
return null
}
}
if ((explorerTest == "0") && (netscapeTest == "3")) {
domainName = netscapeThree()
}
else if ((explorerTest == "0") && (netscapeTest == "4")) {
domainName = netscapeFour()
}
else {
domainName = "Domain name can be detected only on Netscape and compatible browsers. <br>Internet Explorer users must use Netscape to see the actual result"
}
document.write(domainName)
// End -->
</SCRIPT>
</body>
</html>
அசல் கருத்துகள் (3)
வேபேக் மெஷினிலிருந்து (Wayback Machine) மீட்டெடுக்கப்பட்டது