Question: I am writing a web app and I built a script to tell the user they need to be online. I am using JavaScript and JQuery. It does not work. :( This is what I have:

```
var online = navigator.onLine;
$(document).ready(function() {
    if (online == 'false') {
        $('#wifiwarning').fadeToggle("fast");
    };
});

```

Answer: 
It appears [navigator.onLine](https://developer.mozilla.org/en-US/docs/Web/API/NavigatorOnLine.onLine) returns a boolean value, but you are checking for a string. 

Instead of:

```
if (online == 'false')

```

you need to use:

```
if (online == false)

```
I think `if (online == 'false') {` condtion fails.

Use

```
var online = navigator.onLine;
$(document).ready(function() {
    if (online) {
        $('#wifiwarning').fadeToggle("fast");
    };
});

```