javascript - js gets the ip of the user visiting the website
仅有的幸福
仅有的幸福 2017-06-28 09:24:53
0
1
701

There is an existing requirement. There is a portal page, and the page has a link a. When a user visits the portal, get the user's IP and determine if it is in a certain range (for example, the last digit of the IP is between 5 and 8 ) click link a to enter website A, otherwise enter website B.
How to obtain the user's IP when the user visits the portal website?

仅有的幸福
仅有的幸福

reply all(1)
大家讲道理

js should not be able to obtain the IP address directly.
You can make an ajax request to the backend when the page is loading, and the backend will get the IP and return it. Then the front end dynamically adjusts the website pointed to by link a based on the returned IP information

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template