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

chrome.extension.getBackgroundPage() function example

I'm working on a small Chrome extension that needs to run in the background. However, I understand that that isn't possible when I'm using a popup. After some reading it seems that the best option is to create popup.js in order run the…
Niko
  • 369
  • 1
  • 3
  • 14
8
votes
1 answer

Does chrome.runtime support posting messages with transferable objects?

I am learning about Transferable Objects: http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fast They seem pretty awesome and I would like to use them in my extension to speed up passing data from inside of an iframe to outside of…
Sean Anderson
  • 27,963
  • 30
  • 126
  • 237
8
votes
4 answers

Get current URL from within a chrome.contextMenus.onClicked listener

I'm creating my first Chrome extension and I need some help. I I think everything is working except the fact that I can't get the current URL of the tab. var menu = chrome.contextMenus.create({ "title": "extension", "contexts": ["all"] …
xKripz
  • 103
  • 1
  • 1
  • 4
8
votes
2 answers

How to publish Chrome extension to my domain users without paying registration fee?

I haven't paid the "one-time developer registration fee" and I have uploaded my extension. In my developer dashboard it says. "The fee is not required to publish only to users in mydomain.com" How can I publish to users only in mydomain.com without…
Jeevan
  • 3,878
  • 6
  • 29
  • 37
8
votes
1 answer

Chrome Extension: how to change origin in AJAX request header?

I'm trying to manually set an origin in an ajax request header. In my background.js, I have this var ajaxResponse; $.ajax({ type:'POST', url:'www.somewebsite.com/login/login.asp', headers:{ 'origin':…
8
votes
2 answers

How to simulate device-width and orientation in browser to test media queries?

I'm developing my website locally and using Chrome to preview it as I go. While it's really easy to resize the browser to test media queries that use max/min-width, it's not possible from what I can tell to simulate max/min-device-width with any…
Jordan H
  • 52,571
  • 37
  • 201
  • 351
8
votes
1 answer

chrome.runtime.onConnect.addListener() doesn't work on initial chrome tab

UPDATE It now seems like it's only happening in the first case I described, when the Extensions tab is reloaded and a new tab is opened. Possible bug? I'm setting up a chrome extension with a background.js page and a content-script.js. The two…
Orry
  • 257
  • 1
  • 3
  • 10
8
votes
1 answer

Scheduled task as chrome extension

Can I make a scheduled to be as part of chrome extension ? I would like to write the task in JavaScript and make it run periodically in the browser while the browser is running.
Michael
  • 41,026
  • 70
  • 193
  • 341
8
votes
3 answers

communication between native-app and chrome-extension

I have a native app written in c++ and a chrome-extension. I am communicating between them using 'chrome native messaging'. Native-App code: int main(int argc, char* argv[]) { unsigned int a, c, i, t=0; std::string inp; do { inp=""; t=0; //…
8
votes
1 answer

Chrome : Native messaging Error: Access to the specified native messaging host is forbidden

I am running the Native messaging sample app. (http://src.chromium.org/viewvc/chrome/trunk/src/chrome/common/extensions/docs/examples/api/nativeMessaging/). I have added registry key …
8
votes
4 answers

Accessing Google docs from a chrome extension

I know that the Google Drive API allows for drive integration with Chrome Apps, but what about extensions? Can/How do I use the Drive API in a chrome extension? For example I want an extension that will have a popup that list a user's docs, how do I…
8
votes
2 answers

Chrome Extension referencing/calling other script functions from a content script

I have a content script with a lot of functions in it, i would like to be able to split out those functions into other scripts Is there any magic needed to call other scripts from the content script my manifest contains both…
TheGeneral
  • 79,002
  • 9
  • 103
  • 141
8
votes
1 answer

Adding file://. permission to chrome extension

How can I enable permissions for file:/// using chrome extensions. In my manifest.json I have tried: "permissions": [ "file:///*" ] and "permissions": [ "file://*" ] as well as "permissions": [ "*:///C" ] None of these work.
Morne
  • 1,623
  • 2
  • 18
  • 33
8
votes
2 answers

detect if Chrome extension content script has been injected / content script include guard

I want to execute a content script function whenever a tab is updated. The problem is that, sometimes the tab update is ajax (without a page reload), while still changing the page's url. Therefore the old content script injected still exists on the…
Keven Wang
  • 1,208
  • 17
  • 28
8
votes
1 answer

How to capture a screenshot of a single HTML element in Chrome extension?

I know there's a captureVisibleTab, but how do I cut the resulted screenshot of a tab so only a single HTML element is left?
Michael Spector
  • 36,723
  • 6
  • 60
  • 88
1 2 3
99
100