var message = new Notification("RandomString"); message.onclick = function(){ alert("Random Message") };