Note that there are some explanatory texts on larger screens.

plurals
  1. POGoogle Chrome extension: Use Javascript inside webkit notifications?
    primarykey
    data
    text
    <p>I have been following the <a href="http://code.google.com/chrome/extensions/devguide.html" rel="nofollow noreferrer">Google Chrome Extensions Developer's guide</a> and have been able so far to create an extension with a <a href="http://code.google.com/chrome/extensions/browserAction.html" rel="nofollow noreferrer">browser action</a> without popup that would trigger a webkit notification in HTML format.</p> <p>Fact is that this HTML file contains action buttons, links and javascript, but none of them seems to respond.</p> <p>Is this a by-design behavior or is there a way for embedding javascript/links/buttons in these webkit notifications?</p> <p><strong>EDIT:</strong></p> <p>Here are some new insights on the subject:</p> <h3>Javascript</h3> <p>Here is an HTML notification page that doesn't work:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script&gt; alert("hey"); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; content &lt;/body&gt; &lt;/html&gt; </code></pre> <p>As a result, the notification is all blank ; the text <em>"content"</em> isn't displayed.</p> <p>But if I remove the "alert", the text <em>"content"</em> is displayed.</p> <p>I first thought that Javascript was blocking the page from rendering correctly, but I tried something else:</p> <pre><code>&lt;script&gt;document.write("content");&lt;/script&gt; </code></pre> <p>This javascript command is correctly executed and displays the text <em>"content"</em>. We can then assume that Javascript is enabled even in the webkit desktop notifications, but the <em>"alert"</em> function is disabled, and breaks the rendering of the notification page.</p> <h3>Links</h3> <p>Some links work, some don't. Here is a quick list of those I've tested so far:</p> <pre><code>&lt;a href="http://www.google.com/"&gt;Link&lt;/a&gt; # =&gt; Doesn't work &lt;a href="http://www.google.com/" target="_top"&gt;Link&lt;/a&gt; # =&gt; Doesn't work &lt;a href="http://www.google.com/" target="_parent"&gt;Link&lt;/a&gt; # =&gt; Doesn't work &lt;a href="http://www.google.com/" target="_blank"&gt;Link&lt;/a&gt; # =&gt; Works (new tab) </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload