Jump to content
xisto Community
tinoymalayil

To Set User's Geographic Location With Javascript

Recommended Posts

Hi All,I have seen my Geographic location when ever i visit Google's website. How can i set the user's geographic location in my website with the javascript. Any third party provides the javascript template to get the user's geographic location. By getting the user's geographic location, we can change the language of the webpage according to the geographic location. This will be hepful, when we develop multilingual website. Expect a good solution.Regards,Tinoy

Share this post


Link to post
Share on other sites

Hi Tinoy, The best way, in my opinion, to set the language according to the visitor is through the language browser. You can get it, server-side, in the environment variables of php, and then send the appropriate page to your visitor.

Share this post


Link to post
Share on other sites

Hi Tinoy,The best way, in my opinion, to set the language according to the visitor is through the language browser. You can get it, server-side, in the environment variables of php, and then send the appropriate page to your visitor.


I agree with his idea. To help you out, the variables you'll need are HTTP_USER_AGENT and HTTP_ACCEPT_LANGUAGE. Those will give you information not only on the language of the browser, but also the client itself (which allows you to account for mobile vs. desktop and whatnot as well).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.