Forum Moderators: open
Ideally though, I'd like a piece of JavaScript that does different document.writes based upon the IP address.
If the hostaddress is 192.168.anything, function a should be called. Any other hostaddress and function b should be called. Function a would display links for internal use only, whilst function b would display links for normal visitors from outside of our network.
I've found a couple of pieces of JavaScript that can do similar things based upon the referring domain name, but nothing that suits this particular application.
Any suggestions would be appreciated as a starter for six.
R.
Basically, something like this would work:
<script language="javascript">
var ip = '<!--#echo var="REMOTE_ADDR"-->'
var regExp = /^192\.168\.\d{1,3}\.\d{1,3}$/
if(regExp.test(ip)) {
local IP
}
else {
other IP
}
</script>