Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Since things changed over to <code>manifest 2</code>, you are actually no longer allowed to use in-line scripts (such as what you have in your <code>background.html</code> in the <code>&lt;script&gt;</code> tags above. See <a href="http://developer.chrome.com/extensions/contentSecurityPolicy.html#JSExecution">here</a>). I'm not sure of your use case, but in most cases simple cases (read: the stuff I've done :) ), you don't actually need to populate <code>background.html</code> with anything. Instead, you can directly pass in a <code>background.js</code> file that will contain the same script you have above. Therefore you can try changing your <code>manifest.json</code> to this:</p> <pre><code>{ "manifest_version": 2, "name" : "A simple Found Text Demo", "description" : "Bla", "version" : "1.0", "background" : { "scripts" : ["background.js"] }, "page_action" : { "default_icon" : "icon.png" }, "content_scripts" : [{ "matches" : ["*://*/*"], "js" : ["contentscript.js"], "run_at": "document_end" }] } </code></pre> <p>Note we did two things here - changed <code>pages</code> to <code>scripts</code> inside of <code>background</code> and pointed it to <code>["background.js"]</code>, and then added <code>"run_at": "document_end"</code> to the end of the <code>content_scripts</code> section. This is something that can definitely cause issues if left out (issues similar to what you are seeing now) - you are now telling the content script to run after the page has loaded. If it runs immediately, you run the risk of the background page not having loaded, which means it isn't yet ready to receive messages and gives you the connection error. Below is <code>background.js</code>, which is identical to the script you had in between your <code>&lt;script&gt;</code> tags before:</p> <pre class="lang-js prettyprint-override"><code>chrome.extension.onMessage.addListener( function(request, sender, sendResponse){ alert(request); //chrome.pageAction.show(sender.tab.id); sendResponse('Found!'); } ) </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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