Questions tagged [google-chrome-extension]

Extension development for the Google Chrome web browser. You write them using web technologies such as HTML, JavaScript, and CSS.

This tag is dedicated to questions about extension development for the Google Chrome web browser.

The Chrome extension API is documented here.

Absolute beginners should start here.

A good tutorial video by official Google Developers is available on YouTube

Overview of extension architecture can be read here.

The What's New page lists some of the recent changes to the extension APIs, while the Official Chrome Releases Blog announces new releases of Chrome and Chrome OS. For general updates on the browser, visit the Official Chrome Blog.

Troubleshooting

Before posting a question, make sure that you've read the API documentation. If some methods are not documented, it may be because they are deprecated.

If necessary, include relevant parts of your manifest.json file in the question.

A common source of errors is the misunderstanding of manifest version 2 and Content Security policy (CSP). Read the documentation for the CSP to see if it answers to your question.

For anything not related to development of Chrome extensions, such as issues with publishing in the Chrome Web Store, browse the Chromium-extensions Google group (now read-only). Extension authors with questions about the Chrome Web Store can contact the cws-developer-support team at https://support.google.com/chrome_webstore/contact/developer_support/.

Migration to Manifest Version 3

Manifest version 3 is now in support since chrome 88, and will be allowed on the chrome webstore on January 2021. It is recommended to read how to migrate from v2 to v3 and an overview of the new features are found here.

29271 questions
132
votes
3 answers

Checkbox Check Event Listener

Recently I have been working with the Chrome Plugin API and I am looking to develop a plugin which will make life easier for me for managing a website. Now what I wish to do is to fire an event when a certain checkbox is checked. As this website…
129
votes
12 answers

How to import ES6 modules in content script for Chrome Extension

In Chrome 61, support for modules in JavaScript was added. Right now I am running Chrome 63. I am trying to use import/export syntax in Chrome extension content script to use modules. In manifest.json: "content_scripts": [ { "js": [ …
Ragnar
  • 4,292
  • 4
  • 31
  • 41
124
votes
7 answers

Refused to apply inline style because it violates the following Content Security Policy directive

So, in about 1 hour my extensions failed hard. I was doing my extension and it was doing what I pretended. I made some changes, and as I didnt liked I deleted them, and now my extension is throwing error: Refused to apply inline style because it…
123
votes
3 answers

Chrome Extension how to send data from content script to popup.html

I know this this has been asked in numerous posts but honestly I don't get them. I am new to JavaScript, Chrome Extensions and everything and I have this class assignment. So I need to make a plugin that would count DOM objects on any given page…
122
votes
4 answers

Detect Chrome extension first run / update

How can an extension find out that it is being run for the first time or has just been updated, so that the extension can perform some specific actions? (e.g. open a help page or update settings)
rack1
  • 1,221
  • 2
  • 9
  • 3
116
votes
4 answers

Chrome Extension: Make it run every page load

I want to make a chrome extension that executes some scripts after one page is loaded, I am not sure whether I have to implement this logic on the background page or it can be anywhere else, any help here will be greatly appreciated.
albertosh
  • 2,416
  • 7
  • 25
  • 32
116
votes
10 answers

Modify HTTP responses from a Chrome extension

Is it possible to create a Chrome extension that modifies HTTP response bodies? I have looked in the Chrome Extension APIs, but I haven't found anything to do this.
captain dragon
  • 1,289
  • 2
  • 9
  • 8
114
votes
6 answers

sendMessage from extension background or popup to content script doesn't work

I know that question has been repeatedly asked in different ways, but I tried to go through all the answers (hopefully I didn't miss anyone) and none of them worked for me. Here is my extension's code: manifest: { "name": "test", "version":…
Subway
  • 5,286
  • 11
  • 48
  • 59
112
votes
12 answers

Google Chrome Extensions - Can't load local images with CSS

I have a simple Chrome extension that uses the content script feature to modify a website. More specifically, the background-image of said website. For some reason I can't seem to be able to use local images, even though they are packed in the…
Bjarki Jonasson
  • 1,165
  • 3
  • 9
  • 5
109
votes
14 answers

Export CSS changes from inspector (webkit, firebug, etc)

When I'm working with CSS, I'll often test in a browser - say, Chrome - right click an element, click Inspect Element, and edit the CSS right there. The use of arrow keys to change things like margin and padding makes lining things up super…
hookedonwinter
  • 12,436
  • 19
  • 61
  • 74
108
votes
7 answers

Can I programmatically open the devtools from a Google Chrome extension?

I have a chrome extension which hooks into the devtools. Ideally I want a badge that, when clicked, opens up the devtools on the new tab which I created. Is there any way to do this from the background page?
108
votes
7 answers

How do I view the storage of a Chrome Extension I've installed?

It seems like it should be possible to view the localStorage/chrome.storage of Chrome Extensions installed on my browser. I've played around with the Developer Tools a bit, but haven't found a way to do this. Any ideas?
106
votes
13 answers

How to download a CRX file from the Chrome web store for a given ID?

I'd like to download the .crx file of an extension from webstore, I use fiddler to analyze the network request when I install an extension from webstore and got it. For example, for the extension:…
wong2
  • 34,358
  • 48
  • 134
  • 179
106
votes
16 answers

Download content video from video stream with a path of .TS or .m3u8 file through actual code so i can make chrome extension

Videos on most sites make use of progressive downloading, which means that the video is downloaded to my computer, and easy to trace. There are lots of extensions out there to do this, and even in the dev-tools this is easily done. On certain…
103
votes
7 answers

Run script each time Chrome extension icon clicked

How do I write a chrome extension such that every time a user clicks the icon, my script is run but no popup is opened? (I would look this up in the docs myself but for whatever reason they suddenly stopped working, 404ing every page, as I got to…
Endophage
  • 21,038
  • 13
  • 59
  • 90