Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to change icon of chrome extension dynamically on specific criteria meet

I want to change the Icon of Chrome Extension automatically when specific criteria meet. I tried the following function:

chrome.browserAction.setIcon({path: 'image path'})

I'm achieving my functionality by clicking the icon button, when popup appears and icon changed dynamically, if that specific criteria meet.

The problem is, I want this functionality automatically, no need to click the Icon.

Actually I am new to chrome development, May be there is need to registered the method inside the 'manifest.json' file, which automatically triggered the function to change the icon and when our criteria meet than its change the icon.

Thanks in Advance. :)

like image 745
Dawood Butt Avatar asked Feb 02 '26 01:02

Dawood Butt


1 Answers

I think the background pages can help you solve this problem. http://developer.chrome.com/extensions/background_pages.html It is a single long-running script to manage some task or state in background. You can use the setInterval to check the specific criteria. Hope this reference can help you!

like image 122
soarwind Avatar answered Feb 04 '26 16:02

soarwind