Skip to content Skip to sidebar Skip to footer

Why Am I Getting An Error When I Click Chrome Extension?

I am trying to create a simple chrome extension. I was able to load the extension but when I clicked the extension icon next to the address bar I get an error : Unchecked runtime.l

Solution 1:

Content scripts run only when a page loads for the first time in a tab so when you install or reload your extension on chrome://extensions page you also need to reload the tabs or reinject the script explicitly. Also, by default content scripts run after DOMContentLoaded so it may be still pending injection if the page is still loading (you can tell it to run at document_start).

Note that in your use case it's possible you don't need an automatically injected content script so you can remove content_scripts section, remove <all_urls> from permissions, and switch to programmatic injection which can pass data even without messaging.

Post a Comment for "Why Am I Getting An Error When I Click Chrome Extension?"