Updating an extension button dynamically – inspiration required

You may change the extension icon like this: chrome.browserAction.setIcon({path: icon}); There is also a ‘badge’ – small box over the extension icon that shows ie. number of unread messages in gmail extension. You can manipulate it like this: chrome.browserAction.setBadgeBackgroundColor({color:[190, 190, 190, 230]}); chrome.browserAction.setBadgeText({text:”?”}); It is also possible to generate icon dynamically on a canvas element … Read more

Injecting iframe into page with restrictive Content Security Policy

The inability to insert an external iframe in Chrome is a bug (crbug.com/408932). If you want to embed an external frame in an external website, then it must be loaded in a frame that is packaged with your extension. manifest.json { “name”: “Embed external site”, “version”: “1”, “manifest_version”: 2, “content_scripts”: [{ “js”: [“contentscript.js”], “matches”: [“*://*/*”], … Read more

Chrome extension content script re-injection after upgrade or install

There’s a way to allow a content script heavy extension to continue functioning after an upgrade, and to make it work immediately upon installation. Install/upgrade The install method is to simply iterate through all tabs in all windows, and inject some scripts programmatically into tabs with matching URLs. ManifestV3 manifest.json: “background”: {“service_worker”: “background.js”}, “permissions”: [“scripting”], … Read more

sending message to chrome extension from a web page

According to the official docs you should use postMessage in the sender and message event listener in the receiver. Here is an example: Your website’s page.html var data = { type: “FROM_PAGE”, text: “Hello from the webpage!” }; window.postMessage(data, “*”); Content script: (injected using chrome.tabs.executeScript(tabid, {code:…) window.addEventListener(“message”, function(event) { // We only accept messages from … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)