Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

var notification = new Notification

// request permission on page load
document.addEventListener('DOMContentLoaded', function() {
 if (!Notification) {
  alert('Desktop notifications not available in your browser. Try Chromium.');
  return;
 }

 if (Notification.permission !== 'granted')
  Notification.requestPermission();
});


function notifyMe() {
 if (Notification.permission !== 'granted')
  Notification.requestPermission();
 else {
  var notification = new Notification('Notification title', {
   icon: 'http://cdn.sstatic.net/stackexchange/img/logos/so/so-icon.png',
   body: 'Hey there! You've been notified!',
  });
  notification.onclick = function() {
   window.open('http://stackoverflow.com/a/13328397/1269037');
  };
 }
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: add parameter to serialize javascript 
Javascript :: force click btn using jquery 
Javascript :: router.push in vue 3 
Javascript :: get date in specific timezone 
Javascript :: upload image react 
Javascript :: random letter from a name js 
Javascript :: how to display image in react js component 
Javascript :: loop through array in javascript 
Javascript :: vue 3 cdn example 
Javascript :: nginx react router 
Javascript :: react script 
Javascript :: socket.io client send data node js server 
Javascript :: javascript check if two arrays contain same values 
Javascript :: how to enable click copy function using js 
Javascript :: javascript create element input type text 
Javascript :: async import javascript 
Javascript :: how to get file type in javascript 
Javascript :: dm command discord.js 
Javascript :: javascript set class on div 
Javascript :: react native modal close when click outside 
Javascript :: != vs !== javascript 
Javascript :: Immediately-Invoked Function javascript 
Javascript :: string to capitalize javascript 
Javascript :: header disallowed by preflight response in express 
Javascript :: js get selected option elemeng 
Javascript :: javascript create array with repeated values 
Javascript :: remove .html from url express js 
Javascript :: youtube set speed command 
Javascript :: reducer in react example 
Javascript :: polyfill of bind 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =