How to use javascript to determine whether the requested url/link is valid (connectable, usable)?
Introduction
There is an address book system deployed on several servers at the same time, but there is a link to the address book on the homepage, link to The problem with this system is that sometimes the server to which the link points fails, so we hope that when this server fails (the service is unavailable), we can point to links to other servers.
Solution 1: XMLHTTP solution
The following code Excerpted from meizz's reply in [2]: