Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Redirect based on IP address need URGENT HELP!!

Posted on 2000-04-03
5
Medium Priority
?
194 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
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 600 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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

824 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