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
103
votes
2 answers

How can I save information locally in my chrome extension?

I want my chrome extension to save some information, and I'm not sure how to start the code... I need it to save strings. For example - The user inputs a string (In a text area over the popup) and this string is shown on the popup. When the user…
Ariel
  • 2,638
  • 4
  • 23
  • 27
100
votes
4 answers

Chrome extension: How to open a link in new tab?

In my Stackoverflow folder, I have stackoverflow.ico and 2 bellow files. When importing it to Chrome, it shows the icon in address bar, but when I click on it, Chrome doesn't open any new tab. What am I doing wrong? manifest.json { "name":…
NoName
  • 7,940
  • 13
  • 56
  • 108
99
votes
7 answers

Custom protocol handler in chrome

How do i set up a custom protocol handler in chrome? Something like: myprotocol://testfile I would need this to send a request to http://example.com?query=testfile, then send the httpresponse to my extension.
Test Tester
  • 1,409
  • 4
  • 14
  • 14
99
votes
2 answers

Getting the source HTML of the current page from chrome extension

I have a chrome extension. I need to analyse from the HTML source of the current page. I found here all kinds of solutions with background pages and content scripts but none helped me. here is what I have so far: manifest.json { "name":…
Mr T.
  • 4,278
  • 9
  • 44
  • 61
93
votes
2 answers

How often do Chrome extensions automatically update?

When I push a new version of a Chrome extension to the Chrome Web Store, how long will it take for the updated version to reach current users? I pushed an update about six hours ago, but the extension hasn't updated for me yet. The Chrome docs are…
Joe Mornin
  • 8,766
  • 18
  • 57
  • 82
92
votes
6 answers

Chrome extension id - how to find it

How can I find out what the chrome extension id is for an extension?
ZVenue
  • 4,967
  • 16
  • 61
  • 92
92
votes
6 answers

Chrome extension: How to save a file on disk

I'm currently creating an extension for google chrome which can save all images or links to images on the harddrive. The problem is I don't know how to save file on disk with JS or with Google Chrome Extension API. Have you got an idea ?
X-Blaster
  • 1,751
  • 3
  • 15
  • 32
91
votes
3 answers

Is there any way of passing additional data via custom events?

I need to pass data between two autonomic user scripts - ideally without touching the unsafeWindow object - and I thought using custom events would be the way to go. I thought of something like this (let us disregard the MSIE model for the purpose…
Witiko
  • 3,167
  • 3
  • 25
  • 43
91
votes
5 answers

onclick or inline script isn't working in extension

This seems to be the easiest thing to do, but it's just not working. In a normal browser the .html and .js files works perfectly, but in the Chrome/Firefox extension the onClick function is not performing what it's supposed to do. .js file: function…
90
votes
5 answers

Does mobile Google Chrome support browser extensions?

Can I create a plugin or an extension for Google Chrome MOBILE (Android Google Chrome)? If not, can I create an extension for Google Chrome (desktop), which will add a button in Google Chrome bar. This button will open the page in another web…
Alaoui Ghita
  • 1,859
  • 4
  • 22
  • 26
89
votes
8 answers

Persistent Service Worker in Chrome Extension

I need to define my Service Worker as persistent in my Chrome extension because I'm using the webRequest API to intercept some data passed in a form for a specific request, but I don't know how I can do that. I've tried everything, but my Service…
88
votes
9 answers

How can I get the current tab URL for chrome extension?

I know there are many similar questions on SO, but I cannot seem to get it working. I am trying to get the URL of the current tab from my Chrome extension. Hoewever, the alert(tab.url) returns "Undefined". I have added the "tabs" to my permissions…
rybo
  • 1,161
  • 2
  • 10
  • 14
88
votes
8 answers

How to test REST API using Chrome's extension "Advanced Rest Client"

Following the instructions at the link below, I successfully built a REST API for my Django application: http://django-rest-framework.org/tutorial/quickstart. I can test it by doing the following from the Unix prompt: curl -H 'Accept:…
Saqib Ali
  • 11,931
  • 41
  • 133
  • 272
88
votes
1 answer

Devtools doesn't show console or requests for extension popup?

I use console.log heavily to debug when writing JS. I am trying to use it in writing chrome extensions but it is not working. Is there some trickery involved here??? popup.html
gdanko
  • 1,922
  • 4
  • 20
  • 31
88
votes
2 answers

Modify HTML of loaded pages using chrome extensions

How can I add some HTML code to the loaded page if page's title contains specific text? Chrome extensions are new grounds to me and your help would be greatly appreciated.
Luke G
  • 1,741
  • 6
  • 23
  • 34