为什么我的Chrome扩展程序的操作图标显示在多功能框中的所有页面上? [英] Why does my Chrome extension's Action Icon shown on all pages in omnibox?
问题描述
我有以下清单:
page_action:{
default_icon:{
19:images / icon19.png,
38:images / icon38.png
},
default_title:助手for soiduplaan.tallinn.ee
},
content_scripts:[
{
匹配:[
http://soiduplaan.tallinn.ee/*
] ,
但是我在所访问的所有页面中看到我的应用的图标:
我做错了什么? = \
您当前的代码是:
chrome.tabs.onUpdated.addListener(function(a){
chrome.pageAction.show(a);
});
这会导致页面动作在页面加载时显示,即每个页面。 >
如果您只想将页面操作限制到特定页面,请检查 tab.url
属性:
chrome.tabs.onUpdated.addListener(函数(tabId,changeInfo,tab){
if(tab.url&&; tab.url.indexOf('http ://soiduplaan.tallinn.ee/')=== 0){
chrome.pageAction.show(tabId);
}
});
有关更多信息,请阅读 I have following manifest But I see icon of my app in all pages I visit:
What do I do wrong? =\ Your current code is: This causes the page action to be shown whenever a page is loaded, ie for every tab. For more info, read the docs for 这篇关于为什么我的Chrome扩展程序的操作图标显示在多功能框中的所有页面上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
> "page_action": {
"default_icon": {
"19": "images/icon19.png",
"38": "images/icon38.png"
},
"default_title": "Helper for soiduplaan.tallinn.ee"
},
"content_scripts": [
{
"matches": [
"http://soiduplaan.tallinn.ee/*"
],
chrome.tabs.onUpdated.addListener(function(a) {
chrome.pageAction.show(a);
});
If you want to restrict the page action to certain pages only, check the tab.url
property:chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) {
if (tab.url && tab.url.indexOf('http://soiduplaan.tallinn.ee/') === 0) {
chrome.pageAction.show(tabId);
}
});
chrome.tabs.onUpdated
.