Note that there are some explanatory texts on larger screens.

plurals
  1. POJavascript not executing google chrome extensioin
    text
    copied!<p>I'm new in google chrome extensions and I need to develop a popup that let search some text that is inside the popup, I've followed this tutorial: <a href="http://developer.chrome.com/extensions/getstarted.html" rel="nofollow">http://developer.chrome.com/extensions/getstarted.html</a></p> <p>This is the html code of popup.html, it works in the navigator but when I load the extension the popup appears but when I click in find the text is not highlighted.</p> <pre><code>&lt;script src="popup.js" type="text/javascript" &gt; &lt;/script&gt; &lt;input type="text" id="search"&gt; &lt;input type="button" id="button" onmousedown="doSearch(document.getElementById('search').value)" value="Find"&gt; &lt;div id="content"&gt; &lt;p&gt;Here is some searchable text wsdith some lápices in it, and more lápices, and some </code></pre> <p><b>for<i>mat</i>t</b>ing</p> </p> <p>And the popup.js is the following:</p> <pre><code> function doSearch(text) { if (window.find &amp;&amp; window.getSelection) { document.designMode = "on"; var sel = window.getSelection(); sel.collapse(document.body, 0); while (window.find(text)) { document.getElementById("button").blur(); document.execCommand('hiliteColor', false, 'yellow'); sel.collapseToEnd(); } document.designMode = "off"; } else if (document.body.createTextRange) { var textRange = document.body.createTextRange(); while (textRange.findText(text)) { textRange.execCommand("BackColor", false, "yellow"); textRange.collapse(false); } } } </code></pre>
 

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