title: Check if browser notification is available
body: <p>I am working with browser notifications and because it is not available for every browser I want to check in my <em>JS-code</em>, if it is available. </p>
  
  <p>I took a look in the Mozilla developer section:<br>
  <a href="https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API" rel="nofollow noreferrer">https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API/Using_the_Notifications_API</a></p>
  
  <p>They tell me that I should use this code to check whether a browser has notification support or not:</p>
  
  <pre><code>  if (!("Notification" in window)) {
      alert("This browser does not support system notifications");
    }
  </code></pre>
  
  <p>I copied that code into my website; the notification still works in the browsers where it worked before but it blocks the execution of other code (as it did before the 'check'-code).</p>
  
  <p>For example: in the edge browser, I get the console error: </p>
  
  <blockquote>
  <pre><code> 'Notification is undefined'
  </code></pre>
  </blockquote>
  
  <p>So what is the preferred method from you to check whether a browser has notification capability?</p>