How to send browser push Notification using asp.net web-forms?


Hi, I would like to know how can I send or push notification to the user to the browser using asp.net web forms? Something like the below image

browser-push-notification


Asked by:- RameshwarLate
0
: 11909 At:- 11/24/2017 10:47:29 AM
asp.net web-forms browser push notification .net







3 Answers
profileImage Answered by:- Vinnu

You should use javascript plugin provided by Mozilla Developers Network

https://developer.mozilla.org/en-US/docs/Web/API/notification

If you want to trigger notifications from the server side, rather than from the client side, then take a look at SignalR:
http://signalr.net/

There is a plugin also available here https://alxgbsn.co.uk/2013/02/20/notify-js-a-handy-wrapper-for-the-web-notifications-api/

Its working sample here https://alexgibson.github.io/notify.js/

1
At:- 11/24/2017 12:32:37 PM


profileImage Answered by:- vikas_jk

There is another way to add push notification in your website without using much of the code,that is using https://subscribers.com/ you just need to add some javascript on your website or add code in your GTM and that's it you are done.

Subscribers allows you to create "Welcome Drip" also, with the help of which if user subscribe to your website, you can send user some notifications as Welcome messages.

0
At:- 10/9/2018 3:35:09 PM


profileImage Answered by:- bhanu

You can create notifications using Javascript, here is sample JS code

(async () => {
    // create and show the notification
    const showNotification = () => {
        // create a new notification
        const notification = new Notification('JavaScript Notification Example', {
            body: 'This is a JavaScript Notification API demo',
            icon: './img/js.png'
        });

        // close the notification after 10 seconds
        setTimeout(() => {
            notification.close();
        }, 10 * 1000);

        // navigate to a URL when clicked
        notification.addEventListener('click', () => {

            window.open('https://qawithexperts.com/questions/173/how-to-send-browser-push-notification-using-aspnet-web-forms', '_blank');
        });
    }

    // show an error message
    const showError = () => {
        const error = document.querySelector('.error');
        error.style.display = 'block';
        error.textContent = 'You blocked the notifications';
    }

    // check notification permission
    let granted = false;

    if (Notification.permission === 'granted') {
        granted = true;
    } else if (Notification.permission !== 'denied') {
        let permission = await Notification.requestPermission();
        granted = permission === 'granted' ? true : false;
    }

    // show notification or error
    granted ? showNotification() : showError();

})();

OR

You can also use various push notifications API which can be configured using Javascript and easy to use.

1. https://onesignal.com/

2. https://pusher.com/beams

3. https://pushy.me/docs/api/send-notifications (You can send notifications using .NET in this)

4. https://www.webpushr.com/

0
At:- 5/26/2021 11:14:47 AM






Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use