I wasn't able to get any response from my last post, so I'm rewording my question with hope that my question is easier to understand.
I need to get a visitors location and display a custom header graphic based on the Region returned.

For example: I live in Edmonton, in the province of Alberta. If I was to go to the website the header graphic would have:

"We ship to Alberta" in the image. Can anyone help me? It would be much appreciated.

Recommended Answers

All 6 Replies

I need to get a visitors location

Where is that information available? Can you have the visitor/user select it from a list? Or type it into a textfield?

No, somehow I'd need to get the location from the visitors IP address on initial visit, hence the problem.

dont think java has that as a built-in api, maybe look to using google maps api or another one that can take an ip and get current location? or you could just use the knowledge of an ip structure and get the location like that? : http://www.javaranch.com/journal/2008/08/Journal200808.jsp#a2. Also see here: http://stackoverflow.com/questions/1415851/best-way-to-get-geo-location-in-java and http://stackoverflow.com/questions/2244989/need-a-client-side-api-for-determing-geo-location-of-ip-addresses

Thanks for your suggestion and sorry for the slow reply;

dont think java has that as a built-in api

It doesn't have to be Java. Is there another language that you know of that would work with HTML?

PHP has a function that will access an external database for Geolocatin of IP addresses. It uses the GeoIP lite, or full from here: http://www.maxmind.com/app/ip-location . Perhaps you could find a library that does that or write your own?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.