Failed to load resource: net::ERR_NETWORK_IO_SUSPENDED

前端 未结 2 429
攒了一身酷
攒了一身酷 2020-12-24 00:52

I searched Stack Overflow and Google for the specific error message in the title, but I did not find it (in the context of JavaScript coding, not browser settings). On my si

相关标签:
2条回答
  • 2020-12-24 01:19

    Just summarizing my comments under the question for community.

    After some testing, it seems, that setting Ajax timeouts for every call is a must. Without timeouts, NET:: errors such as ERR_NETWORK_IO_SUSPENDED, ERR_INTERNET_DISCONNECTED, etc will cause Ajax to stop execution, and would not resume after computer wake up.

    For jQuery:

    $.ajax({
       url: yourURL,
       timeout: 4000
    });
    

    For XMLHttpRequest (XHR):

     xhr.timeout = 4000;
    

    Moreover, an exception handler is necessary for your script to catch connection errors, so that your JavaScript code would not break down because of unexpected behavior/values.

    Even with timeouts and exeption handler, your application will throw NET:: errors, but they would not harm your application; you could think of them as Notices.

    0 讨论(0)
  • 2020-12-24 01:39

    As much as I think catching exceptions should be the general cure, you might try triggering fake (mouse, scroll, keyboard) events to see if that would prevent Chrome from going to "idle" status.

    Stack Overflow question How to simulate a mouse click using JavaScript? might be helpful.

    0 讨论(0)
提交回复
热议问题