A
A
Alexander Isaev2017-02-01 12:02:38
JavaScript
Alexander Isaev, 2017-02-01 12:02:38

How to detect country and automatically select values ​​from select?

Hello everyone) There is such a task. How to determine the country of the site user and immediately select this country in select. Let's say there is a landing page for some product. There is a select with a choice of the country. When choosing a country, the price of the goods dynamically changes to the desired currency. Maybe someone has a ready script. Thanks for the help.

Answer the question

In order to leave comments, you need to log in

4 answer(s)
K
Konstantin   , 2017-02-09
@SynCap

Yandex to help: codepen.io/SynCap/full/oBjrpv
Free, completely in the browser, no shamanism on the server side.
PS: if I'm not mistaken, then the currency code in the same request can be obtained, and if you conjure a little, then the current exchange rate. How to cram into Select, I suppose, you don’t need to learn, if anything - a list of all countries: https://ru.wikipedia.org/wiki/List_of_countries

D
Dmitry Belyaev, 2017-02-01
@bingo347

Buy a maxmind database or download maxmind lite
Determine the country by ip address, of course, all this is on the server

F
Formula_1, 2017-02-01
@Formula_1

Something similar, only here the city is determined and the phone number changes.
codepen.io/qwerqwer/pen/zNWrOz

A
aleksey, 2017-02-09
@aleksey-popryaduhin

https://developer.mozilla.org/en-US/docs/Web/API/N...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question