Push notifications using jQuery JavaScript/any plugin.
I have a service that will return data as follows:-
Error_Id, Description, DateTime, Etc.
Need to display these fields and it should also contain two buttons i.e. Accept & Reject.
On click of accept/reject button should call another service.
Tried jQuery notifications, but it does not work like browser notifications apis. When browser is minimized it will all minimize.
Tried browser notifications but could not add two custom buttons.
Ref link:-
Also referring the below link it clearly mentions cannot add buttons:- Desktop Notification with HTML Markup ( code example )?
Any help shall be greatly appreciated. Thanks!
Push notifications using jQuery JavaScript/any plugin.
I have a service that will return data as follows:-
Error_Id, Description, DateTime, Etc.
Need to display these fields and it should also contain two buttons i.e. Accept & Reject.
On click of accept/reject button should call another service.
Tried jQuery notifications, but it does not work like browser notifications apis. When browser is minimized it will all minimize.
Tried browser notifications but could not add two custom buttons.
Ref link:- https://web-push-book.gauntface./chapter-05/02-display-a-notification/#title-and-body-options
Also referring the below link it clearly mentions cannot add buttons:- Desktop Notification with HTML Markup ( code example )?
Any help shall be greatly appreciated. Thanks!
Share Improve this question edited Jan 10, 2020 at 11:08 Dev asked Jan 10, 2020 at 10:42 DevDev 4106 silver badges23 bronze badges 2- What you have tried, please show us the code which is not working – Amanjot Commented Jan 10, 2020 at 10:46
- I've updated 2 links containing ref code and another stating cannot add buttons. – Dev Commented Jan 10, 2020 at 11:09
1 Answer
Reset to default 4Use Link for add push notification in web application.
function notifyMe() {
// Let's check if the browser supports notifications
if (!("Notification" in window)) {
alert("This browser does not support desktop notification");
}
// Let's check whether notification permissions have already been granted
else if (Notification.permission === "granted") {
// If it's okay let's create a notification
var notification = new Notification("Hi there!");
}
// Otherwise, we need to ask the user for permission
else if (Notification.permission !== "denied") {
Notification.requestPermission().then(function (permission) {
// If the user accepts, let's create a notification
if (permission === "granted") {
var notification = new Notification("Hi there!");
}
});
}
// At last, if the user has denied notifications, and you
// want to be respectful there is no need to bother them any more.
}
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744743380a4591161.html
评论列表(0条)