Can we redirect based on IP?

J

jonathanthio

Do anyone knows how to redirect based on IP?

Things like if (user.ip=202.23.23.4){
window.location="go here"
}
 
E

Evertjan.

wrote on 05 sep 2005 in comp.lang.javascript:
Do anyone knows how to redirect based on IP?

Things like if (user.ip=202.23.23.4){
window.location="go here"
}

UserIP is not known in clientside javascript or DOM.
[The local machine only knows the local address,
which could be behind a router or proxi]

Serverside however the IP is known.
Warning: the server only sees the external IP,
that could be a proxi sterver or a router.

So serverside ASP in jscript could be:

<%
if (request.servervariables('remote_addr')=='202.23.23.4'){
response.redirect('http://www.xxxx.com/')}
%>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top