What's the best way to check if a website is up or not via JavaScript

前端 未结 5 1204
情深已故
情深已故 2020-12-03 04:00

What is the best way to check if a site is up and running or down with JavaScript?

5条回答
  •  北海茫月
    2020-12-03 04:31

    No AJAX required, just plant an image from the remote site hidden into your site and monitor the load HTTP response status of this image. This might need some tweaks for true crossbrowser compatibility.

    
    

提交回复
热议问题