uworlds Posted October 23, 2021 Share Posted October 23, 2021 Hello, I would be very appreciative for any advice. I want to create a container on a Web page which inserts a clickable image to a variable URL, depending on the country the visitor is from. For example if a visitor is from China then the container imports a specific image with clickable URL from a repository of images and associated URLs. A random selection is fine, but for now I just want to get it working with a single clickable image. rhsnk you ! Link to comment Share on other sites More sharing options...
Ingolme Posted October 23, 2021 Share Posted October 23, 2021 It's not easy and Javascript alone wouldn't be able to do it. You need a server-side language and a database or access to an API. There are two possible approaches: Get the country from the user's IP address by using an IP address database or API. This can only be done by a server-side language. Get the user's coordinates with the geolocation API and use a database or API to determine which country the coordinates belong to. Both of these would take a few hours of work to complete, so it's not something I can write in a forum post. If you want to avoid this complication, the best solution is to ask the user what country they're in, using a dropdown or an autcomplete text field. 1 Link to comment Share on other sites More sharing options...
uworlds Posted October 24, 2021 Author Share Posted October 24, 2021 Thanks so much for your reply again! Yes I can imagine it’s not a short answer. I’ll do some research on what you said thank you. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now