This commit is contained in:
Jonathan Wyss 2024-03-17 01:11:26 +01:00
parent 2485aab123
commit fee1b77f1c
2 changed files with 20 additions and 10 deletions

View File

@ -17,6 +17,16 @@
"background":{ "background":{
"scripts": ["background.js"] "scripts": ["background.js"]
}, },
"host_permissions":["*://youtube.com/*"] "host_permissions":["*://youtube.com/*"],
"content_scripts": [
{
"matches": [
"*://youtube.com/*"
],
"js": [
"spawn.js"
]
}
]
} }

View File

@ -2,13 +2,7 @@
//1.grant host permission //1.grant host permission
// //
// //
browser.runtime.onMessage.addListener(function (message,listener) browser.runtime.onMessage.addListener(() =>
{
handle(message);
});
//if(number>0)
function handle(message)
{ {
console.log("inside handler"); console.log("inside handler");
if(message.state != "Init")//on init only load page if(message.state != "Init")//on init only load page
@ -19,5 +13,11 @@ function handle(message)
let url = message.url; let url = message.url;
console.log(url); console.log(url);
window.location.replace(url); window.location.replace(url);
});
//if(number>0)
function handle(message)
{
// window.location = url; // window.location = url;
} }