Check if the internet available in your computer using JavaScript

check if internet explorer available in your computer using javascript
SharePoint deveopment training course

This SharePoint tutorial, we will discuss how to check if the internet is available or not in our computer through JavaScript Code.

Check if the internet available in your computer using JavaScript

Here I have added JavaScript reference file and bootstrap file. When you will try in your system, make sure you have downloaded all references and keep it in your local drive or SharePoint folder.

Step 1: Login to the SharePoint site- > Create a New Page -> Add a Script Editor We Part-> Copy the below code and paste it inside-> Save the page ->See the O/P

<html>  
<head>  
<title>internet check In your Computer </title>  
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/css/bootstrap.min.css">  
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>  
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.0/js/bootstrap.min.js"></script>  
</head>  
<body>  
<div class="container">  
<div class="row">  
<span>Click on the button to check the internet available or not in your computer</span> <button type="button" class="btn btn-success" onclick="internetCheck()">Try</button>  
</div>  
<span id="internetCheck"></span>  
</div>  
<script>  
function internetCheck() {  
  var value = "Is the browser online? " + navigator.onLine;  
  document.getElementById("internetCheck").innerHTML = value ;  
}  
</script>  
  
</body>  
</html>  
Check if internet explorer available in your computer using JavaScript
Check if internet explorer available in your computer using JavaScript

Step 2: Next click on the Try button to check Internet availability in your computer.

Check if internet explorer available in your computer using JavaScript
Check if internet explorer available in your computer using JavaScript

You may like following JavaScript tutorials:

Hope this JavaScript tutorial helps to learn to check if the internet is there on your computer or not using JavaScript.

Check out Best Alternative to InfoPath -> Try Now

free sharepoint training

SharePoint Online FREE Training

JOIN a FREE SharePoint Video Course (3 Part Video Series)

envelope
envelope

About Rajkiran Swain

Rajkiran is currently working as a SharePoint Consultant in QATAR . Rajkiran having 6 + years of experience in Microsoft Technologies such as SharePoint 2019/2016/2013/2010, MOSS 2007,WSS 3.0, Migration, Asp.Net, C#.Net, Sql Server, Ajax, jQuery etc.He is C#Corner MVP (2 Times).

View all posts by Rajkiran Swain →