Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用Jquery ajaxError来捕获所有 ajax 错误。我遇到了http 状态代码 0的问题。当请求失败(无网络)或用户刷新页面(或单击其他选项卡)时返回此代码。我想区分两者。有什么办法吗?
我认为没有一个简单的解决方案,但有一个解决方法。在http 状态代码 0上,您可以检查...
if(navigator.onLine)
它将返回是否连接了某些网络。