chrome extensions code example
Example 1: where are chrome extensions stored
First navigate to chrome://version
Look for Profile Path
EXAMPLE FOR WINDOWS CHROME
If Profile Path is:
C:\Users\\AppData\Local\Google\Chrome\User Data\Default
Then storage directory is:
C:\Users\\AppData\Local\Google\Chrome\User Data\Default\Extensions
EXAMPLE FOR WINDOWS CHROME CANARY
If Profile Path is:
C:\Users\\AppData\Local\Google\Chrome SxS\User Data\Default
Then storage directory is:
C:\Users\\AppData\Local\Google\Chrome SxS\User Data\Default\Extensions
Example 2: chrome extensions development
{ "name": "Getting Started Example", "version": "1.0", "description": "Build an Extension!", "background": { "scripts": ["background.js"], "persistent": false }, "manifest_version": 2}
Example 3: browser extension manager
Functions
browserAction.setTitle()
Sets the browser action's title. This will be displayed in a tooltip.
browserAction.getTitle()
Gets the browser action's title.
browserAction.setIcon()
Sets the browser action's icon.
browserAction.setPopup()
Sets the HTML document to be opened as a popup when the user clicks on the browser action's icon.
browserAction.getPopup()
Gets the HTML document set as the browser action's popup.
browserAction.openPopup()
Open the browser action's popup.
browserAction.setBadgeText()
Sets the browser action's badge text. The badge is displayed on top of the icon.
browserAction.getBadgeText()
Gets the browser action's badge text.
browserAction.setBadgeBackgroundColor()
Sets the badge's background color.
browserAction.getBadgeBackgroundColor()
Gets the badge's background color.
browserAction.setBadgeTextColor()
Sets the badge's text color.
browserAction.getBadgeTextColor()
Gets the badge's text color.
browserAction.enable()
Enables the browser action for a tab. By default, browser actions are enabled for all tabs.
browserAction.disable()
Disables the browser action for a tab, meaning that it cannot be clicked when that tab is active.
browserAction.isEnabled()
Checks whether the browser action is enabled or not.