The chrome extension I developed works on every domain besides HTTPS ones.
I've tried setting matches like this: "matches": ["http://*/*","https://*/*"].
But it still doesn't work.
This is my manifest.json:
{
"manifest_version": 2,
"name": "My App",
"version": "0.01",
"background": {
"persistent":true,
"page":"background.html"
},
"content_scripts": [{
"matches": ["http://*/*","https://*/*"],
"js": ["app.js"],
"js": ["jquery.min.js"]
}
],
"permissions": [
"tabs",
"http://*/*"
]
}
Well, this is awkward.
Just had to change permissions from:
"permissions": [
"tabs",
"http://*/*"
]
To:
"permissions": [
"tabs",
"http://*/*",
"https://*/*"
]
Related
This is my mainfest.
{
"name": "CVAT FlowChart",
"version": "0.01",
"description": "Easier access to flow charts for QA",
"content_scripts": [
{
"matches": ["<all_urls>"],
"css": ["./style.css"],
"web_accessible_resources": [{
"resources": ["Images/singleimage.png"],
"matches": ["<all_urls>"]
}],
"js": [ "jquery.js", "contentScript.js", "string.js" ]
}
],
"background": {
"service_worker": "background.js"
},
"host_permissions": ["<all_urls>", "http://localhost/*"],
"manifest_version": 3
}
I know I am using the correct src in my js file, because I can get there by following the link that I am imputing. what is wrong with my mainifest. Is there another place that could be the source of my problem?
this is the error I am getting.
Put web_accessible_resources at the same level as content_scripts.
I think your manifest.json is a format error. It would be a bug not to be able to detect it.
manifest.json
{
"name": "CVAT FlowChart",
"version": "0.01",
"description": "Easier access to flow charts for QA",
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"css": [
"./style.css"
],
"js": [
"jquery.js",
"contentScript.js",
"string.js"
]
}
],
"web_accessible_resources": [
{
"resources": [
"Images/singleimage.png"
],
"matches": [
"<all_urls>"
]
}
],
"background": {
"service_worker": "background.js"
},
"host_permissions": [
"<all_urls>",
"http://localhost/*"
],
"manifest_version": 3
}
I am using background.js script to hide my page_action icon with the following code:
chrome.pageAction.hide(sender.tab.id, function(some) {
console.log(sender.tab.id);
});
However, the icon is always 'on' and never gets hidden. I do not have any other functionality which enables the icon, and according to page_action documentation, the icon should be hidden by default.
If I remove my content script from manifest.json, indeed, the icon is disabled by default.
Here is manifest.json:
{
"manifest_version": 2,
"name": "Chrome Extension",
"description": "Chrome Extension",
"minimum_chrome_version": "10.0",
"version": "1.0",
"page_action": {
"default_icon": "logo.png",
"default_popup": "popup.html"
},
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": [
"js/vendor.js",
"js/content_script.js"
],
"css": [
"js/content_script.css"
]
}
],
"background": {
"scripts": [
"js/vendor.js",
"js/background.js"
]
},
"permissions": [
"declarativeContent",
"tabs",
"webNavigation",
"storage",
"activeTab",
"<all_urls>"
]
}
Any thoughts?
I built a Chrome Extension script that is supposed to run on Reddit.
My script:
console.log("hello world");
My manifest.json
{
"manifest_version": 2,
"name": "Name",
"description": "Desc",
"version": "1.0",
"browser_action": {
"default_icon": "icon.png"
},
"content_scripts": [
{
"matches": [
"*://reddit.com/*"
],
"js": [
"contentscript.js"
],
"run_at": "document_end"
}
],
"permissions": [
"tabs", "*://reddit.com/*", "activeTab"
]
}
The script doesn't show up in the "Content Script" section in the chrome dev tools. Does anyone have an idea why my extension is not running?
"*://reddit.com/*" doesn't match a valid url, you should use "*://*.reddit.com/*"
How can I run my extension content script on Google Chrome error page?
For example on the "This webpage is not available" error page? Here is my manifest.json config:
{
"manifest_version": 2,
"name": "injectbox",
"version": "1.1",
"background": {
"scripts": ["jquery-1.11.1.min.js", "bg.js" ]
},
"content_scripts": [
{
"js": [ "jquery-1.11.1.min.js" ],
"matches": [ "<all_urls>" ],
"match_about_blank": true,
"run_at": "document_end"
},
{
"js": [ "content.js" ],
"css":["styles.css"],
"matches": [ "<all_urls>" ],
"match_about_blank": true,
"run_at": "document_end"
}
],
"permissions": [
"tabs", "http://*/*", "https://*/*", "file://*/*", "ftp://*/*",
"webRequest",
"storage"
]
}
I don't think it's possible, most probably this is an internal chrome:// page, which are excluded from page matches.
An alternative solution would be to listen to error events in webRequest/webNavigation APIs and replace the error page with your own.
There is a problem.
I want to get url of tab that called inject-script content.js:
My manifest.json:
{
"background_page": "background.html",
"content_scripts": [ {
"all_frames": true,
"matches": [ "http://*/*", "https://*/*" ],
"js": [ "content.js" ],
"run_at": "document_start"
} ],
"description": "Test...",
"name": "TestExt",
"permissions": [ "tabs", "http://*/*", "https://*/*" ],
"version": "0.1.0"
}
My content.js:
document.addEventListener("beforeload", function(event) {
console.log(document.location.href);
}, true);
Result for link http://ya.ru:
http://ya.ru/
http://kiks.yandex.ru/system/fc06.html
http://suggest.yandex.ru/jquery-1-4-2.crossframeajax.html
but i need to see this
http://ya.ru/
http://ya.ru/
http://ya.ru/
Try window.top.document.location.href.