I created a Chrom extension.
Among the things the extension suppose to do is to run a script in the context of the page after the page loaded.
For some reason, the script isn't running and I'm not sure what am I doing wrong.
Here's the manifest.json
{
"name": "extension sample",
"version": "1.2",
"description": "some desc",
"manifest_version": 2,
"author": "",
"permissions": ["declarativeContent", "storage", "tabs", "activeTab", "https://*/*", "http://*/*"],
"background": {
"scripts":
["background.js" ],
"persistent": false
},
"content_scripts": [
{ "run_at" :"document_end",
"matches": ["https://*/*""],
"js": ["snippet.js"],
"all_frames": true
} ],
"web_accessible_resources":["snippet.js"],
"content_security_policy": "script-src 'self' https://www.google.com; object-src 'self'",
"browser_action": {
"default_popup": "popup.html",
"default_icon": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
}
},
"icons": {
"16": "images/get_started16.png",
"32": "images/get_started32.png",
"48": "images/get_started48.png",
"128": "images/get_started128.png"
}
}
This is the code that runs the script:
chrome.tabs.query({currentWindow: true, active: true}, function (tab) {
chrome.tabs.executeScript(tab.id, {
file: 'snippet.js'
});
});
I just placed the script execution instead of the reload method just to focus on the script execution.
So my question is, why is the script not running?