How does js determine whether the user's network is useful? That is, I want to determine whether the user can use the external network? And make sure he has access to the Internet? God, please help me. . .
闭关修行中......
Request an external network address in the background and see if it can be returned normally.
$.ajax({ url: '/', success: res => alert('应该有网'), error: () => alert('应该没网') });
Want to try it?
You can use it directly, or learn from https://www.npmjs.com/package/ping
https://www.npmjs.com/package/ping
Request an external network address in the background and see if it can be returned normally.
Want to try it?
You can use it directly, or learn from
https://www.npmjs.com/package/ping