Check if browser notification is available

The following code would check whether the browser is compatible with the web notification API

if ('Notification' in window) {
  // API supported
} else {
  // API not supported
}

You should also check for the prefixed versions:

var NotificationIsSupported = !!(window.Notification /* W3C Specification */ || window.webkitNotifications /* old WebKit Browsers */ || navigator.mozNotification /* Firefox for Android and Firefox OS */)

You can read more on how to do this in this article. The article also has a lot of code examples of how to support other devices.