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
1 answer

add button to page with chrome extension

is it possible to add simple button with onclick event to a page with chrome extension? for instance if I am looking at google.com var google = document.getElementById("main"); var button = document.createElement("button"); var text =…
Ali Esmailian
  • 979
  • 3
  • 9
  • 8
8
votes
2 answers

Chrome-extension Javascript to detect dynamically-loaded content

I'm implementing a chrome extension app. I want to replace href attribute in tag (on my webapp's homepage) with "#". The problem is that the tag might be dynamically loaded by ajax, and could be reloaded by user actions. Any suggestions on how to…
Keven Wang
  • 1,208
  • 17
  • 28
8
votes
1 answer

Google Chrome Packaged App - run at system startup

I need to get a Google Packaged App to run at system startup. So, when the OS boots, it automatically loads my app. Any way to do this in Google Chrome?? Thanks in advance.
8
votes
1 answer

Open tab in background and get data from it - Chrome extension

Can someone can give me how to open an url in background and how can I get data from it. The URL that I want to open is in a page that also I get data from it. I use XPath to get data. This is my code : Popup.js chrome.tabs.query({ active: true,…
Soufiene
  • 2,218
  • 3
  • 14
  • 15
8
votes
1 answer

Chrome extension onSuspend is never called

I develop Chrome extension. I try to add event listener to chrome.runtime.onSuspend, but it is never called. I use the following code, but localStorage is not modified and there is no log messages in the console also (I use --enable-logging --v=1…
Anton
  • 317
  • 3
  • 8
8
votes
3 answers

Chrome extension: Execute background page only once when chrome starts

I am playing with chrome extensions, my manifest loads a background page with: ... "background": { "scripts": ["background_page.js"], "persistent": false }, ... The .js code looks like this: var once = false; window.addEventListener("load",…
8
votes
1 answer

Communicating between Chrome DevTools and content script in extension

(I have already read this and it didn't work, and I've done a lot of searching and experimentation to no avail.) I am writing a Chrome extension (BigConsole) with the goal of building a better Console tab for the Chrome developer tools. This means I…
8
votes
1 answer

Override the "cache-control" values in a HTTP response

I have a web page that returns the following header when I access material: HTTP/1.1 200 OK Date: Sat, 29 Jun 2013 15:57:25 GMT Server: Apache Content-Length: 2247515 Cache-Control: no-cache, no-store, must-revalidate, max-age=-1 Pragma: no-cache,…
8
votes
1 answer

Chrome.History get referring URL (JS)

I would like to write a chrome extension which not only lists the URLs visited in the History, but the referring URLs as well. For example, if I clicked on Wikipedia from Google, it should say "Wikipedia: referred to by Google". My initial attempt…
Sergiy
  • 1,029
  • 1
  • 12
  • 19
8
votes
2 answers

Chrome extension: loading a hidden page (without iframe)

Is there a way to load a page, hidden from the user? I can't use an iframe in a background page, because the page has frame-busting techniques. I can't use an XHR, because the page has AJAX - I need its (dynamically generated) DOM.
Chris Broadfoot
  • 5,082
  • 1
  • 29
  • 37
8
votes
2 answers

How to efficiently store/retrieve data to/from chrome.storage.sync?

So, I'm writing an extension to allow people to fine and save colors from images found on the web. It's going well but now I'm trying to conceptualize how I'll actually store them, and list stored items. As far as I can tell, chrome.storage.sync()…
Chris Sobolewski
  • 12,819
  • 12
  • 63
  • 96
8
votes
1 answer

Inspect WebSockets frames from a Chrome Dev Tools extension

I would like to create a Chrome Developer Tools extension (a new panel) to analyze WebSockets frames on our own websites. As far as I understand, http://developer.chrome.com/extensions/devtools.network.html is not complete enough to give access to…
Thomas
  • 1,360
  • 1
  • 9
  • 15
8
votes
1 answer

Chrome Extension - case insensitive content script matches

In my manifest I am injecting some content scripts based on a specific page name. However it appears that the matching is case sensitive, so it matches example.html but not Example.html. How can I make it not case sensitive? "content_scripts": [ …
user887515
  • 794
  • 3
  • 6
  • 19
8
votes
1 answer

Chrome Extension: create new tab(chrome.tabs.create) and executeScript in new tab...not working :(

I’m currently working on a Google Chrome extension that will allow a Pinterest user to easily pin multiple images from a page (a functionality that is currently not available). To achieve this, the extension has a background page and two content…
user2441282
  • 83
  • 1
  • 2
  • 4
8
votes
2 answers

Chrome extension tab.url undefined

I'm using a chrome extension with a button in the popup.html that opens a new tab. The destination URL of the new tab holds the URL of the current (original) tab as a parameter. For instance: when fired from http://stackoverflow.com/, the new tab…
Lionel
  • 83
  • 1
  • 3
1 2 3
99
100