function showDesktopNotification(n_title, n_message, n_url) { var notificationEvents = ['onclick', 'onshow', 'onerror', 'onclose']; var title; var options; //event.preventDefault(); title = n_title; options = { body: n_message, tag: 'new', icon: '' }; Notification.requestPermission(function() { var notification = new Notification(title, options); notification.onclick = function(){ window.focus(); window.open(n_url, '_self'); this.close(); }; }); }