Display Phone Number or link based on Geolocation?

262 views Asked by At

Does anyone know how to have a phone number & link to appear based on the visitors Geolocation or IP address? For instance, lets say I have 5 locations across 2 different states. I want to have the phone number in the header to show the phone number of the location that is closest to the person who is visiting the website.

1

There are 1 answers

0
Nicholas Leader On

You can pull some info from geolocation of the IP address. E.g. http://whois.arin.net/ui/

You can also ask the user's browser for their location: https://developers.google.com/web/fundamentals/native-hardware/user-location/

You would need to extend the above method using browser detection to include other browsers than just Chrome.