Create an extension for Chrome to simply run the background script without user intervention.

I am trying to create a simple extension that runs a script without user intervention . The script will automatically generate notifications, and the user must do nothing but install the extension.

What my background.js looks like,

chrome.alarms.create("myAlarm", { periodInMinutes : 1 }); chrome.alarms.onAlarm.addListener(function(alarm) { if (alarm.name === "myAlarm") { alert("Tick..."); } }); 

So in this case the browser action button is not used. In any case, if I remove the bottom, the extension will not work ( alert with 'Tick' will NOT popup ).

 "browser_action": { "default_icon": "icon.png"} 

If I have just below, then there will still be an icon without an image (( Anyway alert with 'Tick' will popup )).

 "browser_action": { } 

Now I have this ( alert with 'Tick' will popup ),

 { "name": "myExt", "version": "1.0", "manifest_version": 2, "background": { "scripts": ["background.js"] }, "browser_action": { "default_icon": "icon.png" }, "permissions": [ "https://www.google.com/", "notifications", "alarms" ] } 

All I need to do is in the background.js file. It will use chrome.alarms to create periodic notifications.

So, all I want to do is just run the script in the background, any idea on how to remove the browser icon in the menu bar?

0
javascript google-chrome google-chrome-extension
source share
1 answer

Understand that due to some policies of Google itself, now only the user is responsible for hiding the icon. The user who installed the extension can do this with the right mouse button and selecting "Hide in the Chrome menu . "

Therefore, the developer cannot hide the menu icon.

0
source share

All Articles