I tested the error method to intentionally request a timeout and disconnect wifi
Why are the status values all 0? So how do you know if it is overtime or offline?
1. Timeout problem
Config.timeout can set the number of milliseconds to timeout, such as3000If there is no response within 3 seconds, it will be counted as timeout.
2. Network disconnection
Judging whether the network is broken or not can be accessed from the global $window object.window.navigator.onLineThe value of.