Error handling
When it comes to error handling, you have to take both internal and external parameters into account. Internal parameters include errors that can be generated because of the bugs in your code, or an unexpected user behavior. External errors have nothing to do with the application; rather, they are related to parameters you have no control on. The most important one is the network connectivity. Any interactive bidirectional web application requires, well, an active Internet connection.
Checking network availability
Imagine that your users are enjoying your web app, when suddenly the network connection becomes unresponsive in the middle of their task. In modern native desktop and mobile applications, it is a common task to check for network availability. The most common way of doing so is simply making an HTTP request to a website that is supposed to be up (for example, http://www.google.com). If the request succeeds, the desktop or mobile device knows there is active connectivity...