You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ad block will automatically block all calls to common websites that return your IP address information.
There should be a fallback that uses globals in the browser to sniff it out. I do something like this:
const locale = navigator.language
// Step 2: Check if the locale includes the region (country)
if (locale.includes('-')) {
const iso2CountryCode = locale.split('-')[1].toUpperCase();
return iso2CountryCode;
}
// Step 3: Fallback to navigator.languages
if (navigator.languages && navigator.languages.length > 0) {
for (const lang of navigator.languages) {
if (lang.includes('-')) {
const iso2CountryCode = lang.split('-')[1].toUpperCase();
return iso2CountryCode;
}
}
}
Also there's no way to pass a default value for when the IP api call fails which is frustrating.
The text was updated successfully, but these errors were encountered:
Ad block will automatically block all calls to common websites that return your IP address information.
There should be a fallback that uses globals in the browser to sniff it out. I do something like this:
Also there's no way to pass a default value for when the IP api call fails which is frustrating.
The text was updated successfully, but these errors were encountered: