is there any way to find browser location based on city ,state or country....to switch home page accordingly

Recommended Answers

All 2 Replies

no. You can find the ip address from which the request reached you, and call some services that try to give you an estimated location of the computer that ip address is assigned to, but it's not very accurate. Some browsers may also send preferred languages for the user in the http headers, which will usually default to operating system language unless the user changes it.
Proxies, firewalls, and block size of ip addresses can cause incorrect results (e.g. someone working in the UK for a German company but using a French language Windows because he's from the French speaking part of Switzerland might want a French page but show up as either a UK or German location.

You can use the Locale class to get the current configuration

Be a part of the DaniWeb community

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