Solved

Redirect based on IP address need URGENT HELP!!

Posted on 2000-04-03
5
185 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
Comment Utility
Check for the supported language of the browser.
0
 

Author Comment

by:sonixusa
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
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…

762 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now