I'm writing an extension for Google chrome.
I'm trying to write a content script that will take the meta tags from the tab when the popup is clicked.
I have the following permissions in my manifest:
"content_scripts": [{
"js": ["src/js/DOMReader.js"],
"matches" : [
"*://*/*",
"http://*/*",
"https://*/*"
]
}],
"permissions": [
"unlimitedStorage",
"storage",
"notifications",
"activeTab",
"tabs",
"bookmarks",
"browsingData",
"identity",
"topSites",
"history"
]
Whenever I call the content script it returns the default error value, and when I look for it using the developer console sources tab I can't see my content scripts.
I can't properly debug my code because I can't even see the content script to know if anything is wrong. I just want to know why I can't even see my content script, and searching has shown me nothing.
From the documentation:
Content scripts execute in a special environment called an isolated world. They have access to the DOM of the page they are injected into, but not to any JavaScript variables or functions created by the page. It looks to each content script as if there is no other JavaScript executing on the page it is running on.
so this means you won't be able to see it on the same page that your dev tools is inspecting. instead, you'll have to inject code into the webpage you actually want to inspect. method described here (with more detail about content scripts as well)