Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auto select current country #34

Open
borisNG opened this issue Mar 17, 2018 · 1 comment
Open

Auto select current country #34

borisNG opened this issue Mar 17, 2018 · 1 comment

Comments

@borisNG
Copy link

borisNG commented Mar 17, 2018

is it possible to pre-select user's country based on an external ip provider like https://ipinfo.io/pricing ?

@Saffarnejad
Copy link

Saffarnejad commented Jun 26, 2019

You can get the user's country code through the following code:

$(document).ready(function () { var url = "https://ipinfo.io/country"; $.get(url, function (countryCode) { alert(countryCode); //For example show "IR" }); });

Then pass the value to the input before loading the page:

data-selected-country="IR"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants