Questions tagged [safari-app-extension]

Safari app extensions leverage web technologies and native code to extend the web-browsing experience in Safari

Safari app extensions leverage web technologies and native code to extend the web-browsing experience in Safari.

Safari app extensions are available in OS X 10.12 and later and in OS X 10.11.5 when Safari 10 is installed. Using a Safari app extension, you can add new functionality to Safari, read and modify web page content, and communicate with your native application to integrate its content into Safari or send web data to your app.

Safari app extensions are written using a combination of JavaScript, CSS, and native code written in Objective-C or Swift. Safari app extensions are built on the standard app extension model.

Docs: https://developer.apple.com/library/content/documentation/NetworkingInternetWeb/Conceptual/SafariAppExtension_PG/

89 questions
2
votes
1 answer

Is it possible to use safari extension in ios application

I am developing an iOS app with app extension feature.But using "App Extension" we could not customize safari content.Anyone having idea about "Safari Extension".Can we use safari extension in ios app?
2
votes
1 answer

Can I make text badges for Safari App Extension toolbar buttons less ugly?

Safari App Extensions don’t allow you to change toolbar button images dynamically, but they do let you add a string to the button as a badge by passing a string to the extension handler’s validationHandler method: override func…
Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
1
vote
1 answer

Cannot find type 'SFSafariExtensionHandler' in scope

I am creating a Safari App Extension. I downloaded the Sea Creator example project. I want to send messages between the extension and javascript. According to the documentation provided by Apple I should be able to do it with the following…
1
vote
0 answers

How to redirect the search engine using Safari App Extension

I am trying to implement a safari app extension where every search in the safari address bad gets redirected to another search engine(in this care, to DuckDuckGo, just as an example). I have managed to do this much. However, using this logic, if the…
1
vote
1 answer

How to redirect a request in a Safari Content Blocker extension

I am building a safari app extension that will redirect certain requests through a local proxy. For example https://tracking-script.com/track/user/123 needs to be redirected http://localhost:9000 The only problem that I do not know what domains are…
Tony
  • 174
  • 1
  • 6
1
vote
1 answer

Executing code after nested completion handlers

I am writing a Safari app extension and want to fetch the URL for the active page in my view controller. This means nested completion handlers to fetch the window, to fetch the tab, to fetch the page, to access its properties. Annoying but simple…
Rebecka
  • 1,213
  • 8
  • 14
1
vote
0 answers

Strange NSOpenPanel accessory view behaviour in Safari App Extension

I am writing a settings popover for a Safari App Extension. This consists of an table view with an segmented control underneath containing Add, Remove, and Action templates. The latter reveals a menu with items to import and export…
Rebecka
  • 1,213
  • 8
  • 14
1
vote
1 answer

Sending message to WKWebView throws error

I am using WKWebView to load HTML in the popup of my Safari App Extension. I am trying to send a message to this page using webView.evaluateJavaScript("myFunction()") but it fails with error message EXC_BREAKPOINT (code=EXC_I386_BPT, subcode=0x0).…
1
vote
0 answers

How to implement SSO into safari-app-extension without POPOVER toolbar action

I am trying to make SSO auth in my safari-app-extension. And the only way which I found that is creating WKWebView and getting secured cookies from inside. But there are two problems. The first that this is not really SSO, because WKWebView and…
1
vote
1 answer

Safari App Extension content script not loaded on Safari error page?

When running a Safari App Extension, if Safari shows "Failed to open page", your content script isn't loaded. In this sort of scenario, it might be nice to redirect the user to a new url or suggestions page such as "did you mean...". Is it possible…
Kevin Ghadyani
  • 6,829
  • 6
  • 44
  • 62
1
vote
1 answer

Redirect from Safari App Extension Content Blocker

In a Safari App Extension Content Blocker, am I able to assign an action to a trigger that allows me to redirect to another page instead of blocking it outright?
Kevin Ghadyani
  • 6,829
  • 6
  • 44
  • 62
1
vote
1 answer

How to get the state(enabled/disabled) of Safari App Extension from the containing macOS app?

I'm developing a Safari App Extension, which has to included with a containing macOS app. When a user installs this app, the extension is added to Safari, but it's disabled by default. I can use SFSafariApplication.showPreferencesForExtension to…
1
vote
1 answer

How Can I change a toolbar icon in a safari app extension at runtime?

I have found this in the documentation. https://developer.apple.com/documentation/safariservices/sfsafaritoolbaritem which lead me to be able to use the window variable in the toolbarItemClicked function to get a reference to the toolbar item like…
Travis Rivera
  • 428
  • 1
  • 4
  • 19
1
vote
1 answer

Safari App Extensions: Load HTML file on HTTPS page

I'm developing a Safari App Extension (because Safari Extensions are now officially deprecated) and I want to inject some HTML into a page via JS. But when I make a request to my safari-extension:// URL the request is made without SSL, and Safari…
tomjohn
  • 321
  • 3
  • 12
1
vote
1 answer

Safari app extension not detected in showPreferencesForExtension

I'm building an Safari app extension with a main view with a button to enable the extension in safari preferences. The button uses this code: SFSafariApplication.showPreferencesForExtension(withIdentifier: "com.bry.teste.teste1") { (error) in …