Questions tagged [safari-extension]

A legacy API to extend Apple's Safari web browser. As of Safari 14/MacOS 11, a framework named Safari Web Extension implements the standard browser extension APIs. Safari App Extensions, introduced with MacOS 10.12 ("Sierra"), is aimed at integration of native applications with the browser.

Safari Extensions is the term Apple used for a legacy API to extend the browser. As of MacOS 11, Safari Web Extensions (safari-web-extension) is the official framework to implement browser extensions in JS, while Safari App Extensions (safari-app-extension) focus on the integration of native applications with the browser and their communication.

Legacy documentation can be found starting at the Safari Extensions Development Guide.

662 questions
6
votes
0 answers

Is there a way to disable Safari CSP (Content Security Policy) check?

Seems like Safari has a very strong restriction on CSP. For example, on GitHub, most of the userscripts and extension doesn't work because of that. I got a such error from the console. [Error] Refused to execute a script because its hash, its…
6
votes
1 answer

Safari Content Blocker Extension Showing Error Domain=SFErrorDomain Code=3 "(null)"

I'm using safari content blocker extension in my app, i want to use array for blocking using nsuserdefaults , but extension showing this error on reloadContentBlocker "Error Domain=SFErrorDomain Code=3 "(null)"", and here is my code for…
6
votes
2 answers

How can a Safari extension know if Private Browsing mode is on?

I'm writing a Safari extension and want it to behave differently when the user turns on Private Browsing mode (I want to respect this private mode). I found no mention of this in Apple's docs. I'm aware of the discussion in this thread: Detecting if…
Amos
  • 1,403
  • 2
  • 13
  • 19
6
votes
1 answer

Safari Extension – Updating angularJS model on form autocomplete

I’m writing in hopes of finding out how to trigger angularJS to update its model when performing autocompletion from a browser extensions. I know that some other apps (password managers like LastPass) do this successfully. I’m building a little…
Alex
  • 7,432
  • 20
  • 75
  • 118
6
votes
4 answers

Grabbing Edits from two strings

I'm going to go a bit in-depth with my problem, you can jump to the TL;DR if you don't want to read all of this What I'm trying to do I need to store a "file" (text document) which can be user-edited. If I have my original file (which could be…
Downgoat
  • 13,771
  • 5
  • 46
  • 69
6
votes
7 answers

Safari doesn't detect my Extension Certificate

I have registered for the Safari Development Program and have a valid Apple ID. I've followed all the steps given by Apple. The problem is that Windows XP (Service Pack 2) does not recognize the command 'certreq', whereas the instructions said it…
Abubakar Mehmood
  • 938
  • 1
  • 10
  • 19
6
votes
1 answer

Writing an equivalent to Chrome's onBeforeRequest in a Safari extension

Chrome extensions have the ability to intercept all web requests to specified URLs using chrome.webRequest.onBeforeRequest. This includes not only static asset requests, but requests for AJAX, PJAX, favicons, and everything in between. Apple…
6
votes
1 answer

Safari Extension: WebSocket connection failure calls onclose and not onerror and no exception

I'm writing browser extensions for Firefox, Chrome and Safari. When attempting to connect to a WebSocket server using the Safari Extension where there is NO server listening on a particular port, my Safari extension doesn't throw an exception, nor…
Elliott
  • 221
  • 3
  • 12
6
votes
2 answers

Safari Extension Popover Links

Is it possible to have a link work in a Safari popover? I've done just about everything I can think of, but it appears that the adding links to popovers only changes the appearance, and doesn't result in anything clickable, either with href or…
Sunookitsune
  • 327
  • 1
  • 2
  • 9
5
votes
1 answer

Reading browser cookies in safari extension

I am new to safari extension development. I need to access browser cookies specific to a web site. I know that this is possible with in chrome extension development. How can do this with safari extension development.
Ananda Subasinghe
  • 1,265
  • 2
  • 13
  • 24
5
votes
2 answers

Where are the Console Logs of Safari iOS Extension located?

I am building a Safari iOS (v15) extension, using HTML, CSS, and Javascript, in the XCode IDE. But, where are the console logs located? When the extension UI is running on an iOS device simulator then it is very hard to find the root cause without…
Veeresh Devireddy
  • 1,057
  • 12
  • 24
5
votes
3 answers

How to create extension for Safari without release the app?

I now want to write extension for Safari. But xCode offers me first make the app, and then add the safari extension. OK, I created an empty application, started writing my extension, but I have a question. Can I release an extension without…
GenRiH
  • 132
  • 2
  • 11
5
votes
0 answers

chrome.webRequest and safari

I'm trying to port a Chrome/Firefox extension for Safari. But the extension use a lot a feature of those browsers that doesn't seem to exist in Safari : chrome.webRequest (https://developer.chrome.com/extensions/webRequest). The chrome.webRequest…
5
votes
2 answers

Safari extension that spoofs user-agent?

Is it possible to spoof the user agent using a Safari extension? I know that Safari itself is able to spoof using the Develop menu item, but it's too limited for me. As far as I know, Safari extensions use 'start' and 'end' scripts, but both are…
Rits
  • 5,105
  • 4
  • 42
  • 53
5
votes
0 answers

Communication between Safari 10 App Extension and parent application

I'm creating a new Safari App Extension with the Safari 10 and Xcode 8 betas. This is working fine and I can communicate between the injected JavaScript and the App Extension. But I also want to communicate between the App Extension and the parent…
Geigi
  • 61
  • 2