Note that there are some explanatory texts on larger screens.

plurals
  1. POchrome.management.onInstalled.addListener throwing Uncaught SyntaxError: Unexpected identifier
    primarykey
    data
    text
    <p>I am trying to write a chrome extension to listen to the install / uninstall / enabled / disabled events for other extensions either by using chrome web store or by other means.</p> <p>I am planning to use the chrome.management module for that.</p> <ol> <li><p>I had declared the permissions in the manifest.json file.</p> <pre><code>"permissions": [ "management" ], </code></pre></li> <li><p>I have a background.html page</p> <pre><code>"background": { "page": "background.html" }, </code></pre></li> <li><p>I had included the background.js as a part of the background.html page</p> <pre><code>&lt;html&gt; &lt;script type="text/javascript" src="js/background.js"&gt;&lt;/script&gt; &lt;body&gt; &lt;/body&gt; &lt;/html&gt; </code></pre></li> <li><p>And here is my background.js</p> <pre><code>chrome.management.onInstalled.addListener(function(ExtensionInfo info) { console.log('somethingz installed...'); printInfo(info); }); chrome.management.onEnabled.addListener(function(ExtensionInfo info) { console.log('somethingz enabled...'); printInfo(info); }); chrome.management.onDisabled.addListener(function(ExtensionInfo info) { console.log('somethingz disabled...'); printInfo(info); }); function printInfo(info) { console.log("id: " ++ info.id); console.log("name: " ++ info.name); console.log("description: " ++ info.description); console.log("version: " ++ info.version); console.log("mayDisable: " ++ info.mayDisable); console.log("enabled: " ++ info.enabled); console.log("disabledReason: " ++ info.disabledReason); console.log("type: " ++ info.type); console.log("appLaunchURL: " ++ info.appLaunchURL); console.log("homepageUrl: " ++ info.homepageUrl ); console.log("updateUrl: " ++ info.updateUrl ); console.log("offlineEnabled: " ++ info.offlineEnabled); console.log("optionsUrl: " ++ info.optionsUrl); console.log("icons: " ++ info.icons); console.log("permissions: " ++ info.permissions); console.log("hostPermissions: " ++ info.hostPermissions); console.log("installType: " ++ info.installType); } </code></pre></li> </ol> <p>I am trying to debug the background.html page by looking at the chrome://extensions page and I am seeing -</p> <pre><code> Uncaught SyntaxError: Unexpected identifier </code></pre> <p>and the events are not firing as expected because of this error.</p> <p>Please help!! not sure what is causing the "Uncaught SyntaxError: Unexpected identifier" error... May be it is something too basic, however, I am not able to catch it by looking at it for quite some time!</p>
    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.
    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