<html>
<body>
<p id="demo">Click the button to see if the browser is online.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var x=navigator.onLine;
document.getElementById("demo").innerHTML=x;
}
</script>
</body>
</html>