I need to determine a user’s country, and it doesn’t need to be super accurate (getting it right 90% of the time is probably enough). I realized the time zone returned by JavaScript could work.
Example:
console.log(Intl.DateTimeFormat().resolvedOptions().timeZone);
Will return America/Toronto
or America/New_York
, which can help me differentiate a Canadian from an American.
Sure I understand this is based on the user’s preferences, not its real location. But is there a huge pitfall I’m not seeing right now using this technic?