I have a chrome extension that needs to work/execute only on a specific sub subfolder of a website but not on other parts of the website
I want it to execute only on https://example.com/subfolder1/sub_subfolder11/ but not on https://example.com/subfolder1/ or https://example.com/subfolder2/ or https://example.com/subfolder3/
This is the manifest.
"permissions": [
"storage",
"declarativeContent",
"https://example.com/subfolder1/subfolder2/*",
"tabs",
"activeTab"
],
"manifest_version": 2,
"background": {
"scripts": ["background.js"],
"persistent": false
},
"web_accessible_resources": [
"style.css"
],
"content_scripts": [
{
"all_frames": true,
"css": ["style.css"],
"matches": ["https://example.com/subfolder1/sub_subfolder11/*"],
"run_at": "document_end"
}
The extension works/executes everywhere not just on https://example.com/subfolder1/sub_subfolder11/ Any idea what I'm doing wrong?
UPDATED SINCE I CAN'T COMMENT SUCH A LONG TEXT
Hi @wOxxOm , I have seen you around on many other questions so I would like to thank you for being so helpful.
Related to my issue, I have two tabs ( or more tabs ) on chrome. On one I have the https://example.com/subfolder1/sub_subfolder11/*
open and that tab content has links that point to https://example.com/subfolder1/ or https://example.com/subfolder2/ or https://example.com/subfolder3/
and those open in a new tab ( <a target="_blank"...
).
I have tried also manually entering the addresses ( https://example.com/subfolder1/ or https://example.com/subfolder2/ or https://example.com/subfolder3/
) by opening new tabs but still, the extension gets executed.
On background.js I have tried having nothing there and also having chrome.webRequest.onBeforeRequest.addListener ( to block specific javascript links from loading ) but still the same.
The idea is to block scripts from loading on https://example.com/subfolder1/sub_subfolder11/*
but don't block those scripts in a new tab when I go manually to https://example.com/subfolder1/ or https://example.com/subfolder2/ or https://example.com/subfolder3/
Thank you