I want to run my local javascript file instead of server's file. I'm using manifest v3 on Chrome extension.
My manifest.json:
{
"manifest_version": 3,
"name": "Replace js",
"description": "",
"version": "1.0",
"content_scripts": [
{
"js": [
"content-script.js"
],
"matches": [
"https://mine.com/*"
]
}
],
"background": {
"service_worker": "background.js"
},
"action": {
"default_popup": "popup.html"
},
"permissions": [
"declarativeNetRequest",
"declarativeNetRequestFeedback",
"webRequest",
"scripting",
"activeTab"
],
"host_permissions": [
"*://www.mine.com/*"
]
}
And background.js file
chrome.webRequest.onBeforeRequest.addListener(
function (details) {
if (details.url == "https://www.mine.com/remote.js")
// run my file
},
{ urls: ["*://www.mine.com/*.js"] },
["blocking"]
);
But onBeforeRequest
is deprecated in manifest v3
Could anyone help me?