Je développe une extension chrome. Je souhaite rediriger vers une page html personnalisée lorsqu'un nouvel onglet est créé.
Il s'agit du fichier process.js.
chrome.tabs.onCreated.addListener(function() {
alert("hello");
window.open('https://ucsc.cmb.ac.lk/', '_self', false);
});
Il s'agit du fichier manifest.json.
{
"manifest_version": 2,
"name": "xxx",
"version": "1.0",
"description": "xxx",
"icons": {
"128": "icon128.png",
"48": "icon48.png",
"16": "icon16.png"
},
"browser_action": {
"default_icon": "icon16.png",
"default_popup": "popup.html"
},
"background": {
"scripts": ["process.js"],
"presistent": true
},
"permissions": [
"storage",
"notifications",
"contextMenus",
"tabs",
"activeTab",
"http://*/",
"https://*/"
]
}
l'alerte fonctionne. mais il ne charge pas la page.
0
awpathum
8 nov. 2019 à 09:43
2 réponses
Meilleure réponse
Vous cherchez probablement Remplacer les pages .
Ajoutez ce code à votre fichier manifeste:
"chrome_url_overrides" : {
"pageToOverride": "myPage.html"
},
1
ishan shah
8 nov. 2019 à 07:52
Vous pouvez essayer ceci:
window.open('https://ucsc.cmb.ac.lk/', '_blank', false);
0
Dino
8 nov. 2019 à 09:58