ARTICLE AD BOX
So far I've always been patient enough to search SO until I found a working solution. However I am really stuck on this one.
I am trying to achieve the following:
Display a chrome extension in a new tab instead of a popup Once a search button is clicked a new page should be opened A content script should read the DOM and return it The content should be displayed on the extension pageWhenever I click the search button a new page is opened. However, I never get back any response but an error telling me "Unchecked runtime.lastError: Could not establish connection. Receiving end does not exist.".
I assume there is an issue with the registration of the listener. I've seen questions where the issue was that a message has been sent before a listener has been registered. I can imagine something similar here but I have not yet been able to resolve it by searching answers on SO.
If anyone would have the patience to help some chrome extension newbie with this issue any help will be really appreciated!
manifest.json
{ "manifest_version": 3, "name": "Test", "version": "1", "icons": { "32": "images/favicon.png" }, "action": { "default_title":"Test", "default_popup": "ui/main.html" }, "content_security_policy": { "extension_pages": "script-src 'self'; object-src 'self'; script-src-elem 'self' 'unsafe-inline' http://code.jquery.com/jquery-latest.min.js;" }, "background": { "service_worker": "js/background.js" }, "content_scripts": [{ "matches": ["*://*/*"], "js": ["js/content.js"] }], "permissions": [ "activeTab" ] }main.html
main.js
content.js
background.js
