<p>I have a web application where there are number of Ajax components which refresh themselves every so often inside a page (it's a dashboard of sorts).</p>

<p>Now, I want to add functionality to the page so that when there is no Internet connectivity, the current content of the page doesn't change and a message appears on the page saying that the page is offline (currently, as these various gadgets on the page try to refresh themselves and find that there is no connectivity, their old data vanishes).</p>

<p>So, what is the best way to go about this?</p>

```
```
navigator.onLine
```
```
That should do what you're asking.
You probably want to check that in whatever code you have that updates the page. Eg:
```
```
if (navigator.onLine) {
    updatePage();
} else {
    displayOfflineWarning();
}
```
```