title: webkitNotifications - SECURITY_ERR: DOM Exception 18 - script, OK - button
body: <p>I followed <a href="http://www.beakkon.com/tutorial/html5/desktop-notification" rel="noreferrer">http://www.beakkon.com/tutorial/html5/desktop-notification</a> tutorial for html 5 desktop notifications. The demo on that page work for me. If i copy entire code it works so, but... when i call the method from javascript it don't display niether the notification or permision request. Instead it raises <code>SECURITY_ERR: DOM Exception 18</code>. </p>
  
  <p>It seems the error is raised by the line which creates the notification itself.</p>
  
  <p>Has anybody glue why button works and calling the function directly does not?</p>
  
  <hr>
  
  <p>My current code:</p>
  
  <pre><code>function RequestPermission(callback)
  {
    window.webkitNotifications.requestPermission(callback);
  }
  
  function notif() {
    if (window.webkitNotifications.checkPermission() &gt; 0) {
      RequestPermission(notif);
    }
  
    notification = window.webkitNotifications.createHTMLNotification('http://localhost:3000/images/rails.png');
    notification.show();
  }
  </code></pre>
  
  <p>Does not compute:</p>
  
  <pre><code>notif();
  </code></pre>
  
  <p>Computes:</p>
  
  <pre><code>&lt;button onclick="notif()"&gt;NOTIFY&lt;/button&gt;
  </code></pre>
  
  <p>Google Chrome:  9.0.597.84 (Oficiální sestavení 72991)</p>
  
  <p>WebKit: 534.13</p>