jjzjj

browserAction

全部标签

javascript - chrome.browserAction.setIcon 没有做任何事情

我正在制作一个chrome扩展程序,该扩展程序有两种模式:始终打开(alwaysOn),或者仅当用户单击它时(onClick)。我想根据用户的模式将图标更改为蓝色或红色,以便他们一眼就能看到。但是,在添加chrome.browserAction.setIcon()行之后,图标在需要时仍然没有改变。它只是保留在默认Logo上。这是我的background.js://Getthebehavioroftheplugin;thedefaultissetto"onClick",theotheroptionis"alwaysOn"chrome.storage.sync.get({extension

javascript - 为什么这个 chrome.browserAction.setIcon 方法不起作用?

I'mlookingatthedocumentationpage我不知道我的代码有什么问题:chrome.browserAction.setIcon({details.imageData={"48":"Icons/iconfavorite48x.png","64":"Icons/iconfavorite64x.png","128":"Icons/iconfavorite128x.png"}});文档说:Notethat'details.imageData=foo'isequivalentto'details.imageData={'19':foo}'所以我很困惑

javascript - chrome.browserAction.onClicked.addListener() 弹出窗口

我想将监听器添加到每次单击浏览器图标时触发的事件。我还有一个弹出窗口,单击此图标会弹出。我尝试了chrome.browserAction.onClicked.addListener()但没有成功,后来我看到文档说:Firedwhenabrowseractioniconisclicked.Thiseventwillnotfireifthebrowseractionhasapopup.所以,我有弹出窗口,所以这个Listener不起作用。在我的案例中,我可以采取什么解决方法将Listener附加到图标? 最佳答案 没有解决方法可以将监听

javascript - 如何为每个选项卡保留 chrome.browserAction.setBadgeText?

我的扩展程序使用tab.url获取数据并将其放入chrome.browserAction.setBadgeText。当我打开一个新标签时,它会重置。如何仅为新标签更新BadgeText?并为旧的保持不变?扩展布局:chrome.tabs.onUpdated.addListener(function(tabId,changeInfo,tab){function(tabId,changeInfo,tab){//usingtab.urlandXMLHttpRequest()igetnewTextfor:chrome.browserAction.setBadgeText({text:newTe

javascript - 使用函数触发 chrome.browserAction.onClicked

我想触发点击,下面的代码正在监听:chrome.browserAction.onClicked.addListener(function(tab){});原因是我有一个工作扩展,它在后台脚本(上面的addListener)中监听并在点击时执行一些脚本:chrome.browserAction.onClicked.addListener(function(tab){chrome.tabs.executeScript(tab.id,{file:'abc.js'});chrome.tabs.executeScript(tab.id,{file:'xxx.js'});});现在我想从上下文菜单