I couldn’t find any working example to get users ip adress. I tried every example code and example wix websites to get ip adress but none of them worked on the client side. (They are working perfectly on backend but it always giving me wix servers ip adresss) What is the up-to-date method to get ip adress of the user and log it on console? Help would be appreciated.
Perhaps this can help…
https://russian-dima.wixsite.com/meinewebsite/ip-adress
Did you try the website ? Its not working, not showing the ip please try it.As I said I can’t find any working example
@makislaskos28968 Everything works just fine for me…
If you wish to use wix only, you can create a GET http-function that returns the request.ip
https://www.wix.com/velo/reference/wix-http-functions/wixhttpfunctionrequest-obj/ip
Good to know! Thanks for the tip.
I’d suggest to handle any potential CORS (Cross-Origin Resource Sharing) issues that may arise when making requests from the client side.
One workaround is to utilize a third-party service like ipify. org, which provides an API for fetching the user’s IP address. You can make an HTTP request to this service from your client-side code and log the returned IP address to the console using JavaScript.
Here’s a simple example to get you started:
fetch(‘api. ipify. org? format=json’)
.then(response => response.json())
.then(data => console.log(‘User IP Address:’, data.ip))
.catch(error => console.error(‘Error fetching IP address:’, error));
For more information on IP addresses and networking, you can check out this article about 1921681. I hope this helps someone.
One workaround is to utilize a third-party service like ipify.org, which provides an API for fetching the user’s IP address. You can make an HTTP request to this service from your client-side code and log the returned IP address to the console using JavaScript.