notes/Basic web notifications and service worker-KbmWUEci.html
<html>
<head>
  <script>
    var n;
    navigator.serviceWorker.register('sw.js');
    function showNotification(title,body,icon,tag) {
      Notification.requestPermission(function(result) {
        if (result === 'granted') {
          navigator.serviceWorker.ready.then(function(registration) {
            registration.showNotification(title, {
              body: body,
              icon: icon,
              vibrate: [200, 100, 200, 100, 200, 100, 200]
            });

          });
        }
      });
    }

  </script>
</head>
<body>
  <button onclick='showNotification("My Title","This is the body","http://filmsbykris.com/v7/img/tux.png","My Tag")'>Click Me</button>
  <br>
  don't forget to:<br>
  touch sw.js
</body>
</html>

syntax highlighted by Code2HTML, v. 0.9.1