How to inject script to all frames matching URL from browser extension background-script?

In our browser extension background-script we have a code that injects content-script to all tabs matching specific URL. It is used to activate extension after it is installed without need to reload matching page(s):

  status: 'complete',
  url: 'https://**'
}, function (tabs) {
  tabs.forEach(function (tab) {
    chrome.tabs.executeScript(, {
      file: 'content-script.js',
      runAt: 'document_idle'

Is there a way to inject content-script also to all frames matching this URL? Eg. if somebody has our webapp ( embedded in his page ( We need to do it without any additional extension permissions (now they are desktopCapture and https://* or without mentioning anywhere in our extension. Otherwise we would use webNavigation API.

Associate requests with active page

I’m working on a browser extension (compatible with Chrome, FF, Opera, and Edge) and I’m trying to figure out how to associate requests to domains outside of the current page. For example, when you go to a lot of requests to domains other than occur such as to

An extension like NoScript shows all of the requested domains that a page made and lets you allow or deny. I’m trying to get a similar functionality.

Is this something that can be done in the content script or is there some way to keep state information in the background script that I can then display in the popup? Obviously it’s possible but I’m just not seeing which callback I can use.

Chrome Extension: Run Content Script before any Embedded Scripts run on Page

I’m trying to change some behavior of the YouTube player, by changing some variables inside of the player_api script that is embedded into the html watch page of videos.

The embedded script i'm trying to modify

Problem is, whatever i try, the embedded script of the player always runs before my extension adds modifications to it. Thus keeping the behavior of the player the same.

I tried setting the run_at property in my manifest to document-start, but then the script didn’t run at all.

What can i do to halt the execution of that script until i make changes to it?

PS: I tried changing the script by intercepting the html call and editing the body with Charles Proxy and the behavior of the player changed as i wanted. So it know it should work, if done at the right time.



    "manifest_version": 2,
    "name": "YouFit For YouTube",
    "version": "1",
    "content_scripts": [{
        "js": ["content.js"],
        "matches": ["https://**",
    "browser_action": {
        "default_icon": "icon.png"


function changeBehavior() {
    var scriptElements = document.getElementsByTagName('script');
    for (var i = 14; i < scriptElements.length; i++) {
        var curScriptBody = scriptElements[i].outerHTML;
        // Find the script i'm interested in
        if (curScriptBody.indexOf("var ytplayer") != -1) {
            scriptElements[i].outerHTML = scriptElements[i].outerHTML.replace("", "");

How to monetize a browser extension by injecting ads

I am looking to monetize a browser extension by injecting (non-intrusive, non-tracking, clearly indicated and clearly communicated) ads within websites visited by the extension’s users.

Could you advise on which ad networks may allow this?

Are there any other caveats?

Is it possible to modify KeyboardEvent before webpage processes it?

I am trying to figure out if it is possible to re-map keyboard shortcut defined by a web application, because that would solve this issue: Frustration over Shift+Space YouTube keyboard shortcut when creating subtitles.

So, I was thinking: would it be possible, for a Chrome/Mozilla/… extension to capture and modify KeyboardEvent (in this case, just clear the Shift modifier for space character) before the event is passed to the web application?

I was looking for such an extension but no success yet. Is it possible to do it, in principle?

Get Add my own content to gmail compose box using inboxsdk

I am developing a chrome addon and I want to append my own content at the end to mail content using InboxSDK. I am using the following code, but it’s appending to my cursor position in Gmail Compose Box.

var cv = event.composeView;
cv.insertTextIntoBodyAtCursor('My Content');

also, I want to append content before sending mail. So, How I can achieve it using InboxSDK.

Thanks in advance

chrome extension to download a media file to webpage and send it to another API

I am going to develop a chrome extension, which capture some media file related to current login user, download it then send to another API .
I know i can download it through chrome downloads API but my question confusion is

  1. if i download media file through content script and chrome Downloads API, On what location it will store.

  2. How can i transfer or get recent Downloaded file and sent to another API

If you have better approach please suggest or correct me.

chrome extension giving error when installing .crx custom plugin file

I have created an extension. Then I create crx file of extension and install it.
It’s Installed but it ask to repair, and not shown in the tool bar with other extensions.


MutationObserver in “new” Google Calendar

I have an browser extension for Google Calendar, where I observe the DOM to gather events that are being viewed with:

// content.js
const calendarContainer = document.getElementById('gridcontainer');
const observer = new MutationObserver(mutations => {
  // just for test
  console.log('content', mutations);

observer.observe(calendarContainer, {
  childList: true,
  characterData: true,
  subtree: true

It works correctly in “classic” Calendar, but since the last update to Material design, DOM structure is different. So, I tried to change observed element accordingly:

// content.js
const calendarContainer = document.querySelector('div[role="main"]');

Even though I switch between week/day view, schedule or between dates, I cannot receive any new mutations besides first load of the page (after refresh). If you look on the source code trough Developer Tools you can see that DOM is changing, but Observer is somehow not able to see it.

Any thoughts?

Modify gmail compose box

I am developing a browser extension like “HubSpot sales”, I want to modify my Gmail compose box like same “HubSpot sales” doing.
I am using Gmail.js for it.

Can anyone help me overcome to add my custom dom element in Compose popup box form using Gmail.js with a small demo.

Thanks in advance.