PDA

View Full Version : Use JavaScript to display content based on ip address


NoahT
08-15-2008, 09:00 PM
New to any programming.

I am trying to display a specific picture to a visitor based on their IP Address. I.e., if the ip is x.xx.xxx.x display a picture of a dog. If the ip is y.yy.yyy.y display a picture of a cat, etc. Need to use server-side content.

Thanks

shyam
08-16-2008, 03:34 PM
you should check out javax.servlet.http.HttpServlet.getRequestAddr() (http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletRequest.html#getRemoteAddr())

ps. you cannot do it in javascript