• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 200
  • Last Modified:

Redirect based on IP address need URGENT HELP!!

I would like to redirect a person to a specific page by redirecting them based on whether they are in the united states or outside and send them to the appropriate page. I am not sure if javascript is the most appropriate
language but i am looking for some advice.
thanx
0
sonixusa
Asked:
sonixusa
1 Solution
 
CJ_SCommented:
Check for the supported language of the browser.
0
 
sonixusaAuthor Commented:
will that show the difference between the u.s. and canada, england, austrailia.. etc??
and do you have a sample script to look at??
thanx
0
 
Michel PlungjanIT ExpertCommented:
A better way is to reverse lookup the IP address on the server and redirect on domain.

However - the best way is to ask!!!

I use an english (internatonal) browser in Holland and I am Danish.
How do you know what language I want and what country I want to go to???

Michel
0
 
yolishCommented:
Basing anything on the IP address is a risky situation due to the fact people might be dialing up to an ISP/Company in a different country, or if the users are going through a Proxy Server you run into all sorts of IP issues... It sounds like the best way is what CJ S mentioned, check what version/language of the browser the user installed and go from there... If that doesn't work, put a set of flags on a splash page and let the user decide....
0
 
kollegovCommented:
Using JavaApplet is the only way to get IP on client-side for MIE..

You can use my IPcatcher applet, you would find demo page here:
http://www.geocities.com/SiliconValley/Lakes/8620/vmaxipcatcher.html

It have javascript callback when IP detected it will call JavaScript function setIP(s)
IP is passed to this call as string.

This applet Work for NN3+, MIE4+

all you need is to parse IP address
and do whatever you need based on IP.

Main site entry
http://www.geocities.com/SiliconValley/Lakes/8620
(you would need it to reach downloads links)

--------------------------
If you need to do redirection for specific language than detecting IP wouldn't be best way. Many countries have several languages, so it will be
better to ask user ar at least try to
detect preferred language directly

<script>
if(document.all)lang=navigator.browserLanguage.toLowerCase()
if(document.layers)lang=navigator.language.toLowerCase()
alert(lang)
</script>

Than you would need to parse
standard abreviations like "en-us" in MIE and "en_us" in NN

Note that second token can be absent
you can get "en" only, and separator is different: NN use _ and mie use -

first token can be obtained

mainLang = lang.substring(0,2)

Next step is finding of best matching supported page.

if(mainLang=="en"){
  ....
}else if(mainLang=="fr"){
  ....
}

e.t.c

Virtual_Max








0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now