Questions tagged [web-extension]

Web Extension is API for major browser extension(plugin) development. Use this tag together with browser specific tags google-chrome-extension firefox-addon-webextensions safari-web-extension when you target all browsers and care for compatibility.

Browser Web Extension becomes standard for browser extension/plugin/addon development. Originally developed in Chrome, it was later adopted by Firefox and Edge, and in 2021 by Safari.

However as of 2021 there is no vendor neutral spec, and every browser has its own documentation. W3C WebExtensions Community Group (WECG) https://github.com/w3c/webextensions/ is ongoing effort for standardization.

87 questions
1
vote
2 answers

Background page runs, but popup says 'You do not have a background page.' when using getBackgroundPage()

I have a very simple background page for a Chrome extension: chrome.runtime.onInstalled.addListener((reason) => { console.log(reason); }); The background page runs when my extension is loaded: The extension also has a popup that runs…
1
vote
1 answer

converting chrome extension to safari extension on excode I am getting this error {Optional(Error Domain=SFErrorDomain Code=1 "(null)")}

Steps to reproduce:- Converted the chrome extension with this command (xcrun safari-web-extension-converter /path/to/extension) Then after conversion, it opens in Xcode. Then in the signing tab, I selected Team and bundle Identifier. After this…
1
vote
2 answers

How to switch tabs in a browser Web Extension

As title states ^ In these docs, there's a lot of support for working with tabs. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs Including moving tabs around, deleting them, duplicating, reloading, executing…
1
vote
2 answers

Detecting if browser extension popup is running on a tab that has content script

There a few similar questions, but none of them have really gotten at what I'm asking. I have a browser action popup. In the popup, I want to display settings if you're on a page where the content script has been injected (i.e., any page that…
Nathan
  • 73,987
  • 14
  • 40
  • 69
1
vote
1 answer

Create new tab from Firefox extension doesn't works

i'm trying to create a new tab from Firefox extension, but it doesn't works. manifest.js: { "manifest_version": 2, "name": "nafy", "version": "1.0", "description": "NaFy", "icons": { "48": "icons/icon_48.png", "96":…
1
vote
0 answers

I want to ignore libs folder from minimizer while using webextension-toolbox.config.js

Here is the code that I am using to customize the webpack config. I tried multiple ways to ignore libs from minimizer but I am unable to skip them by using plugins. Here is the output of the build process // This file is not going through babel…
1
vote
1 answer

Sanitise unicode pair for filename in javascript?

My web-extension fails to initiate file download for filenames having a pair of emojis with invalid filename error, this seems to be some unicode surrogate pair issue when multiple emojis are used. Here is the offending filename example:
1
vote
0 answers

Manifest V3 web extension overwrite response body

How would I overwrite the response body for an image with a dynamic value in a Manifest V3 Chrome extension? This overwrite would happen in the background, as per the Firefox example, (see below) meaning no attaching debuggers or requiring users to…
1
vote
0 answers

How can I open a sidebar link in the same tab?

Is there a way to open a link in a WebExtension sidebar to the currently active tab? I don't want to automatically open the link in a new tab. I'm talking about regular links: Example Things I've tried: Adding…
Xiyng
  • 327
  • 1
  • 5
  • 16
1
vote
0 answers

When are the scenarios where 'tabs.onUpdated' event fired other that url changed

In our extension code I have a listerner added to tabs.onUpdated ( chrome.tabs.onUpdated ) browser.tabs.onUpdated.addListener(async (tabId, changeInfo, tab) => { } }) In one of the interactions inside extension on button click this…
1
vote
0 answers

How to get website's logo and name by javascript

I am working on a browser WebExtension, one feature of my extension is to get the icon image and name of the website which user is browsing. I found some ways to get the icon, e.g https:///favicon.ico link and metadata in header, such…
1
vote
0 answers

How can I redirect to a new tab with some href URL and with a search cookie/parameter which can give some value like ID or account number?

**Example :**Building an extension which redirect to new tab when click on button or link with URL and with some search cookies or parameter which can give value at URL bar like id or account no. Something like this:1)…
1
vote
0 answers

(Chrome Extension) How to focus on the omnibox when you create a new tab?

I'm making a chrome extension that redirects you to a specific url every time you open a new tab. The code I'm using is down below. However it is really annoying that whenever I open a new tab, it does it's job in redirecting me to the url but it…
Venkata P.
  • 11
  • 1
1
vote
0 answers

Converting safari web extension from git repo not successful

I'm trying to convert a chrome web extension to a safari extension. My environment is a Big Sur VM with XCode 12.5.1. When I clone the extension's git repo (https://github.com/toobeeh/skribbltypo) and try to convert it with "xcrun…
tobeh
  • 11
  • 2
1
vote
0 answers

documentUrlPatterns not respecting pathnames

I am running into some issues when attempting to use documentUrlPatterns with my web extension, on Safari, when creating context menu items. Example: browser.contextMenus.create({id: "12354", title:…