javascript - Desktop push notification? -
i want send desktop notification customer dynamical server side. example have 1 website based on e-commerce platform. want send desktop notification customer new offers available. created notification following code.. want call notification without user activity.
$(window).load(function(){ if(!window.notification){ console.log('sorry notification not supported'); } else { notification.requestpermission(function(p){ if(p === 'denied') { } else if(p === 'granted') { } else { } console.log(p); }); } var notify; if(notification.permission === 'default') { console.log('please allow notification'); } else { notify = new notification('cashback notification..',{ body : 'get assured cashback on purchases made via getex.com', icon : 'images/notification_getex.png' }); } }); here trigger notification window load, want notify server side execute or call api link. please me thanks!
Comments
Post a Comment