Questions tagged [safari-web-extension]

Apple's implementation, starting with MacOS 11/Safari 14, of the browser extension API already in use by Firefox and Google Chrome

Safari Web Extensions are Apple's implementation of the extension APIs now common among Safari, Firefox, and Google Chrome.

Official Documentation

Safari Web Extensions are distinct from Safari App Extensions, which focus on interoperability of native MacOS and iOS applications and the browser. Safari Extension is a legacy API deprecated with MacOS 10.12.

45 questions
0
votes
0 answers

Safari WEB extension: passing var from background.js to content.js

In my boilerplate Safari Web Extension code, I have a var "baseURLString". By means of messaging, I am able to pass that var to my background.js as follows: browser.runtime.sendNativeMessage("application.id", {message: "getBaseUrlString"},…
Sjakelien
  • 2,255
  • 3
  • 25
  • 43
0
votes
0 answers

How do I make my Safari browser extension have read access to all sites immediately after installation?

For example, Grammarly has the following permissions after installation. So it works on every website and don't ask for access. In my case I have the following permissions: And I need to go to the settings and allow it separately. What can I do?
elmagxd
  • 121
  • 5
0
votes
0 answers

Can MacOS Safari Web Extensions issue local notifications without asking for permission twice?

I'm attempting to convert an extension from Chrome/Firefox to Safari. Having followed instructions here, everything seems to work except for notifications. chrome.notifications is undefined in Safari, both for manifest v2 and v3. In a v3 extension's…
0
votes
0 answers

Safari web extension content script's runtime.Port won't post message after extension was re-enabled

I am developing an extension that lets web pages and extensions exchange data. And there's a user scenario like the one below. User opens a website that matches the content script list. The user can use the web page normally (The content script and…
0
votes
1 answer

Porting Chrome extension to Safari error: `The service_worker script failed to load due to an error`

I have a Chrome extension that works as expected. When I port it to Safari I get an error that can't be debugged. Steps taken (from the dev docs): Run xcrun safari-web-extension-converter This throws a warning that…
0
votes
0 answers

chrome.webRequest equivalent in iOS Safari Webextension

Since iOS Safari doesn't support web request is there another way to capture the web requests? I don't want to modify it just wanted to capture some of the intra web requests that the parent page makes
user3685509
  • 25
  • 1
  • 5
0
votes
1 answer

Safari Refused to load because it does not appear in the img-src directive of the Content Security Policy, but works in Chrome

I have a Safari extension which loads images from Unsplash from the domain https://images.unsplash.com. I recently migrated to manifest v3 and used the following CSP in manifest.json: "content_security_policy": { "extension_pages": "img-src…
0
votes
1 answer

Can a Safari web extension change Safari's browser preferences

Is it possible to write a Safari extension that changes the web browsers preference settings? If so where would I find documentation on this? I would like to add a search engine to the list of default ones so if there is already an extension that…
John554
  • 145
  • 1
  • 7
0
votes
0 answers

Why browser.downloads.dowload hits into "undefined is not an object" error for Safari extension?

While trying to port my extension to Safari (using xcrun safari-web-extension-converter) from Firefox add-on, the browser.downloads.download implementation in my extension to download the user options stored hits into following error: TypeError:…
0
votes
1 answer

Create a Safari WebExtension to Toggle a class

I'm new to building web extensions and I'm struggling to do some simple action. All I want is to click a button in the menubar to toggle a class. Seems like most examples I have found are out of date or are Chrome specific? Does someone have any…
kevski
  • 21
  • 5
0
votes
1 answer

WebExtension API: Toggle DOM replace on/off

I'm just starting to work with the WebExtension API (on Safari rather than Chrome), and I've gotten as far as having the extension show a button in the popover ui and on clicking it the content.js script will replace any given word on a page with…
0
votes
1 answer

How does a webpage send a message to a Safari Web Extension?

How does javascript code on a webpage trigger the sending of a message to a Safari Web Extension? It appears browser.runtime.connectNative() will allow a background script to communicate with the native app. Most specifically, stateful data can be…
Graham Leggett
  • 911
  • 7
  • 20
0
votes
1 answer

Cannot find 'SFExtensionMessageKey' in scope

I'm trying to build the Native Messaging Test Project and it keeps failing to build with Cannot find 'SFExtensionMessageKey' in scope. How do I fix this? The error comes from this bit of code: SafariWebExtensionHandler.swift /* See LICENSE folder…
cameck
  • 2,058
  • 20
  • 32
0
votes
1 answer

OAuth Redirect URL in (the new) Safari Web Extension

I am porting my chrome extension to Safari. The extension requires the user to sign-in and I use the OAuth code flow, which requires a redirect url. In Chrome, I can use chrome.runtime.getURL('/mypage.html') as a redirect url because in chrome the…
HereNerd
  • 1
  • 1
-1
votes
1 answer

how to detect if any web extensions are being used

I want to detect using vanilla javascript if the end-user has any webextensions enabled at all. Is there a way to query for a list of browser enabled webextensions? Hopefully there is another way besides checking for injected scripts, css and image…
user1709076
  • 2,538
  • 9
  • 38
  • 59
1 2
3