Solved

Redirect based on IP address need URGENT HELP!!

Posted on 2000-04-03
5
190 Views
Last Modified: 2006-11-17
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
Comment
Question by:sonixusa
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 22

Expert Comment

by:CJ_S
ID: 2681218
Check for the supported language of the browser.
0
 

Author Comment

by:sonixusa
ID: 2681262
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
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 2681423
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
 

Expert Comment

by:yolish
ID: 2681916
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
 
LVL 10

Accepted Solution

by:
kollegov earned 200 total points
ID: 2682292
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

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question