chrome extention chrome.webRequest no information was obtained [duplicate] - google-chrome-extension

I am new to the extension development
I have tried with permissions url as
"<all_urls>
"*"
"http://*/*", "https://*/*"
None of the pattern is working
Full manifest:
{
"name": "Info",
"description": "BS System Info",
"version": "1.0",
"manifest_version": 3,
"background": {
"service_worker": "background.js"
},
"content_scripts": [{
"js": ["script.js"],
"matches": ["http://*/*","https://*/*","<all_urls>"],
"css" : []
}],
"permissions": [
"storage",
"activeTab",
"system.cpu",
"system.memory",
"system.storage",
"system.display",
"tabs",
"scripting",
"http://*/*", "https://*/*", "chrome-devtools://*/*"
],
"action": {
"default_popup": "index.html",
"default_icon": {
"16": "/images/icon_16.png",
"32": "/images/icon_32.png",
"48": "/images/icon_48.png",
"128":"/images/icon_128.png"
}
}
}

Site/URL permissions in ManifestV3 use a separate key: host_permissions
"host_permissions": [
"*://*.example.org/"
],
"permissions": [
"storage"
],
More info in the official migration guide, make sure to study it.

Related

Issue with creating an extension NativeMessaging in V3: unknow key path and type

I'm trying to make a Chrome extension that opens a local exe (nativeMEssaging) but when I'm trying to load it I have this error: It doesn't know the key path and type so how can I do?
Here is my manifest.json:
{
"name": "debug.reader.eid",
"description": "Console app use to read an eid and send date to extension",
"path": "C:\\debug.reader.eid\\debug.reader.eid.exe",
"type": "stdio",
"externally_connectable": {
"matches": [
"https://*.extranet-test.debug.be/*",
"*://localhost/*"
]
},
"background": {
"service_worker": "background.js"
},
"author": "debug",
"icons": {
"128": "addon-debug.png"
},
"manifest_version": 3,
"permissions": [
"nativeMessaging"
],
"version": "1.0",
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": [
"content.js"
],
"run_at": "document_start"
}
],
"action": {
"default_icon": {
"16": "addon-debug.png"
},
"default_title": "test",
"default_popup": "popup.html"
}
}

captureVisibleTab is returning undefined [duplicate]

I am new to the extension development
I have tried with permissions url as
"<all_urls>
"*"
"http://*/*", "https://*/*"
None of the pattern is working
Full manifest:
{
"name": "Info",
"description": "BS System Info",
"version": "1.0",
"manifest_version": 3,
"background": {
"service_worker": "background.js"
},
"content_scripts": [{
"js": ["script.js"],
"matches": ["http://*/*","https://*/*","<all_urls>"],
"css" : []
}],
"permissions": [
"storage",
"activeTab",
"system.cpu",
"system.memory",
"system.storage",
"system.display",
"tabs",
"scripting",
"http://*/*", "https://*/*", "chrome-devtools://*/*"
],
"action": {
"default_popup": "index.html",
"default_icon": {
"16": "/images/icon_16.png",
"32": "/images/icon_32.png",
"48": "/images/icon_48.png",
"128":"/images/icon_128.png"
}
}
}
Site/URL permissions in ManifestV3 use a separate key: host_permissions
"host_permissions": [
"*://*.example.org/"
],
"permissions": [
"storage"
],
More info in the official migration guide, make sure to study it.

Get network data in chrome extension

I have a chrome extenison but i can't figure out how to access the data in the devtools network tab and send to the popup. Any suggestion?
it's basically a bug reporting chrome extension where you can take screenshots, create issue, and I need the network log (and/or console)
manifest.json
{
"manifest_version": 2,
"name": "my-chrome-extension",
"description": "Chrome Extension for report bug",
"version": "1.0",
"background": {
"scripts": [
"js/background.js"
],
"persistent": false
},
"icons": {
"16": "./icon.png",
"36": "./icon.png",
"48": "./icon.png",
"120": "./icon.png"
},
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": [
"js/vendor.js", "js/content_script.js"
]
}
],
"web_accessible_resources": [
"inject-script.js",
"js/inject-script.js"
],
"browser_action": {
"default_popup": "popup.html",
"default_title": "PerfWatch"
},
"permissions": [
"tabs",
"activeTab",
"storage"
]
}
You cant access it directly. Only via API like webRequest via bg script.
Example:
chrome.webRequest.onBeforeRequest.addListener((details) => {
//This identifies a redirect to another page
if (details.url.indexOf("Target") && details.method === "OPTIONS/..." && details.initiator.indexOf("Source")) {
chrome.tabs.sendMessage(details.tabId, {
message: "xyz"
});
}
})
Your manifest.json must include the webRequest permission in order to access the webRequests:
{
"manifest_version": 2,
"name": "my-chrome-extension",
"description": "Chrome Extension for report bug",
"version": "1.0",
"background": {
"scripts": [
"js/background.js"
],
"persistent": false
},
"icons": {
"16": "./icon.png",
"36": "./icon.png",
"48": "./icon.png",
"120": "./icon.png"
},
"content_scripts": [
{
"matches": [
"<all_urls>"
],
"js": [
"js/vendor.js", "js/content_script.js"
]
}
],
"web_accessible_resources": [
"inject-script.js",
"js/inject-script.js"
],
"browser_action": {
"default_popup": "popup.html",
"default_title": "PerfWatch"
},
"permissions": [
"tabs",
"activeTab",
"storage",
"webRequest"
]
}
Hint:
There are additional APIs like webNavigation and webRequestBlocking if you need more funtionallity.

Why does my manifest.json trigger a lengthly review due to Broad Host Permissions?

The chrome webstore flags my extension as having "Broad Host Permissions", but I cannot figure out what in my manifest.json is causing this result.
{
"name": "AudioEye Smart Remediation Builder",
"description": "Solve any issue of accessibility without writing code. Select elements, apply changes, and fix the web.",
"devtools_page": "src/main.html",
"version": "1.31.0",
"content_security_policy": "script-src 'self' https://myother.website.com/scripts/loader.js https://myotherother.website.com/somescript.js; object-src 'self'",
"author": "AudioEye",
"background": {
"scripts": [
"src/background.bundle.js"
]
},
"browser_action": {
"default_icon": {
"16": "icons/ae16.png",
"48": "icons/ae48.png",
"128": "icons/ae128.png"
},
"default_popup": "src/popup.html"
},
"content_scripts": [
{
"matches": [
"*://my.website.com/*"
],
"run_at": "document_end",
"all_frames": true,
"js": [
"src/installDefinition.js"
]
}
],
"externally_connectable": {
"matches": [
"*://my.website.com/*"
]
},
"icons": {
"16": "icons/ae16.png",
"48": "icons/ae48.png",
"128": "icons/ae128.png"
},
"manifest_version": 2,
"optional_permissions": [
"http://*/*",
"https://*/*",
"tabs"
],
"permissions": [
"cookies",
"webNavigation",
"activeTab",
"storage",
"contextMenus"
],
"web_accessible_resources": [
"src/inspected-window.bundle.js",
"src/smart-remediation-metadata.js"
]
}
I only use a broad match in the optional_permissions object, which gives the user explicit ability to allow/deny the permissions on each page they visit.
Why does my extension require a two week review due to broad host permissions?

chrome tabs event don't work on background js

in my permission
"background": {
"scripts": [ "request.js" ]
},
"browser_action": {
"default_icon": "uefa.png",
"default_popup": "popup.html",
"default_title": "as2"
},
"content_scripts": [ {
"js": [ "content.js" ],
"matches": [ "http://*/*", "https://*/*" ]
} ],
"description": "moving",
"manifest_version": 2,
"name": "as2",
"permissions": [ "http://*/*", "https://*/*", "tabs", "webRequest", "webRequestBlocking", "storage", "webNavigation", "\u003Call_urls>", "cookies" ],
"update_url": "https://clients2.google.com/service/update2/crx",
"version": "1.4",
and request.js
chrome.tabs.onUpdated.addListener(function (tabId, changeInfo, tab)
{
alert("onUpdated"+tab.url);
});
chrome.tabs.onActivated.addListener(function(activeInfo) {
alert("onActivate"+tab.url);
});
chrome.windows.getAll({populate:true},function(windows)
{
windows.forEach(function(window)
{
window.tabs.forEach(function(tab)
{
if(tab.url.indexOf("https://www.bet-at-home.com/en/sport/live/") != -1)
{
alert("ssdsf::"+tab.id);
}
});
});
});
it is works well!
but problem is if without debug window, it never works.
anybody knows about these bug?
it has tabs permission already, and did not work tabs.remove too.
Can you be more specific? I ran your code with a blank popup.html and the following manifest.json and onUpdated worked fine:
{
"background": {
"scripts": [ "request.js" ]
},
"browser_action": {
"default_popup": "popup.html",
"default_title": "as2"
},
"description": "moving",
"manifest_version": 2,
"name": "as2",
"permissions": [ "tabs" ],
"version": "1.4"
}

Resources