How can I use javascript to determine whether the requested url/link is valid (connectable and available )? Introduction There is an address book system deployed on several servers at the same time, but there is a Address Book link on the home page to link to this system. the problem is that sometimes the link to the server fails, so I hope... syntaxHighlighter. all ();
How can I use javascript to determine whether the requested url/link is valid (connectable and available )?
Introduction
There is an address book system deployed on several servers at the same time, but there is a Address Book link on the home page to link to this system. the problem is that sometimes the link points to a server with a failure, so you want to point to other servers when the server is faulty (the service is unavailable.
Solution 1: XMLHTTP
The following code is taken from the reply of meizz in [2: