How to use js to do a redirect for certain ip?

How to use js to determine the ip address and do a redirect? For an American ip redirect should not be.
July 2nd 19 at 18:18
2 answers
July 2nd 19 at 18:20
You can make an ajax request to the server. Server lopatic headers and sends the IP (or the old transition).
a possible example of pseudo code? - Kenton83 commented on July 2nd 19 at 18:23
July 2nd 19 at 18:22
If it is not possible to use htaccess, then AJAX'om send request to a PHP script and doing whatever you want.
I don't know php. I only know a little js - Kenton83 commented on July 2nd 19 at 18:25
: there JS no way to know the IP address. - arnold2 commented on July 2nd 19 at 18:28

Find more questions by tags JavaScriptProgramming