Wrox Home  
Search P2P Archive for: Go

  Return to Index  

javascript thread: HELP!! IP Redirect


Message #1 by "Mário Ramos" <mjpr@f...> on Tue, 30 Oct 2001 11:26:36
Mario,

Two things:

First, "addr.getHostAddress" is not Javascript and
will set the varable "ip" to null in it's current
iplementation.  It is JAVA so you will need a little
more code to make it work.  

Second, you need to add a ".substring(x,y)" method to
the "ip" varable in the "if" statement if you only
want to check a portion of the "ip" string.

A simple Yahoo (or your favorite search engine) search
should give you plenty of information to do this
yourself.


Bernie


--- Mário Ramos <mjpr@f...> wrote:
> Hi everybody..
> 
> I'm trying to do a script that redirects the user to
> differnt pages based 
> on their ip.
> 
> Something like:
> 
> -----------------
> var redirectLocation 
> "http://www.foo.univ.pt/p.html";
> var redirectLocation1 
> "http://www.foo.univ.pt/p1.html";
> ip=addr.getHostAddress();
> 
> function Redirect() {
> 	if (ip=193.136.184.) {
> 		location = redirectLocation;
> 	} else {
> 		location = redirectLocation1;
> 	}
> }
> 
> Redirect();
> 
> ----------------
> 
> Question:
> 1- Can I use ip=193.136.184. without the termination
> for any ip that 
> starts like that? or does the ip var
> (addr.getHostAddress(); ) makes that 
> impossible?
> Does this seem to stupid?
> 
> Thanks in advance.
> Mário Ramos.

  Return to Index