How to send Web Push Notification using push.js?


In this article, I will share with you how to send web push notifications using push.js with a simple example. you all know what is web push notification? and what needed push notification in our web application.

Right now you can see many web applications use the web base push notification in web applications for some more user engagement. so, in this article, i will share how to send web-based push notifications to your web application in a very simple way. here I'm using PushJs to send push web notifications.

I also uploaded one simple demo of web push notification on GitHub so, you can also download it from here Download Demo

Preview :

Example :

<!DOCTYPE html>
    <title>Web push notification using push.js - LaravelCode</title>
    <link rel="stylesheet" href="" />
    <script src=""></script>
    <script src="push.js"></script>
    <script src="serverWorker.js"></script>
    <div class="container text-center">
        <h1>Web push notification using push.js - LaravelCode</h1>
            <button class="btn btn-info" id="sendPushNotification">Send Push Notification.</button>
    <script type="text/javascript">
            $('#sendPushNotification').on('click', function(){
                Push.create("Hello world!", {
                    body: "This is my first notification :)",
                    icon: '/notification.png',
                    timeout: 40000,
                    onClick: function () {

i hope it will be help in your web development.