Online Ping In Vanilla JavaScript – Ping.js

Category: Javascript | April 14, 2021
Views Total:566 views
Official Page:Go to website
Last Update:April 14, 2021


Online Ping In Vanilla JavaScript – Ping.js


Ping.js is a vanilla JavaScript library to provide an online ping functionality on the client-side.

How to use it:

1. Install & download the package.

$ npm i ping.js --save

2. Import the Ping.js as an ES module.

import Ping from 'ping.js';

3. Or load the compiled JavaScript from the dist folder.

<script src="dist/ping.min.js"></script>

4. Create a new Ping instance.

var p = new Ping();

5. Ping a specific website and get the response time."", function(err, data) {
  if (err) {
    console.log("no response")
  document.getElementById("output").innerHTML = data;

6. Available options to customize the Ping tool.

var p = new Ping({
    // replace it with your own favicon
    favicon: "/favicon.ico",
    // timeout in ms
    timeout: 0,
    // whether to log errors
    logError: false


v0.3.0 (04/14/2021)

  • Support ES6 Promise

You Might Be Interested In:

Leave a Reply