Я пытаюсь запустить свое расширение page_action chrome только на веб-сайте ebay. Вот мой манифест. json файл:
{
"manifest_version":2,
"name":"Ebay",
"description":"Downloads Ebay data ",
"version":"1.0.0",
"icons":{"128":"icon_128.png"},
"permissions":[
"activeTab",
"notifications",
"tabs",
"https://www.ebay.com/*"
],
"page_action":{
"default_icon":"icon_128.png",
"default_popup":"popup.html",
"default_title":"Download Ebay data"
},
"content_scripts":[
{
"matches":["https://www.ebay.com/*"],
"js":["src/jquery.js","content.js"]
}
],
"background":{
"scripts":["eventPage.js"],
"persistent":false
}
}
Вот мой content.js
файл:
//Send message to the event page to highlight the icon
chrome.runtime.sendMessage({todo:"showPageAction"});
А вот мой eventPage.js
файл:
chrome.runtime.onMessage.addListener(function(request,sender,sendResponse){
if(request.todo == "showPageAction"){
chrome.tabs.query({active:true,currentWindow:true},function(tabs){
chrome.pageAction.show(tabs[0].id)
})
}
})
Значок отображается на всех страницах, а не только на странице ebay.