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?
大家讲道理2017-06-28 09:26:53
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