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
26
votes
2 answers

Why aren’t my Safari App Extension NSLog messages showing up in the console in Xcode?

I’m following Apple’s guide for creating a Safari App Extension. In short, I’ve: Created a new Xcode project (in Xcode 8.1, on macOS 10.12 Sierra) using the Cocoa Application template Created a new target in the app using the Safari Extension…
Paul D. Waite
  • 96,640
  • 56
  • 199
  • 270
12
votes
2 answers

How can I close a Safari App Extension popover programmatically?

I'm building a Safari App Extension using XCode 8.3 and Swift 3, following the Safari App Extension Programming Guide. The extension includes a popover that appears when the extension's toolbar item is clicked. The popover view contains a few…
Aaron Frary
  • 906
  • 1
  • 13
  • 24
11
votes
8 answers

Convert Web Extension to Safari App Extension

I have Web Extensions which currently runs on Chrome, Firefox and Opera. Now I'm wondering is there a way to use same code to build Safari App Extension, maybe something like PhoneGap(wrap all existing JS code in Safari App Extension project) or…
9
votes
1 answer

Create a "Safari App Extension" for macOS application created with Electron?

Since the release of "Safari App Extension" I have toyed around with creating safari app extensions for native applications using xcode. Now however, I'm attempting to create an extension for an application that was built using the Electron…
6
votes
2 answers

safari app extension crashes after a few seconds for hello world project

open xcode file > new >project > Cocoa app file > new > target > safari extension compile and run extension select safari. xcode compiles with no errors. Safari opens for a few seconds then crashes. this is the output of the debug…
Travis Rivera
  • 428
  • 1
  • 4
  • 19
6
votes
2 answers

How to listen to "beforeNavigate" event in safari app extensions

I'm developing a safari app extension. I've to listen to "beforeNavigate" event as in old Safari JS Extensions, we could listen to these events using Safari's Windows & Tabs API. I went through the How to create Safari App Extension, but…
6
votes
2 answers

Safari App Extension: WKWebKit in Popover not loading content

The objective To implement a Safari App Extension that shows a popover with a WebView inside that shows a webpage. The problem The popover shows up correctly in Safari, clicking on it brings up a blank popover with nothing in it. Based on logs in…
msharp
  • 81
  • 5
5
votes
4 answers

how to communicate between safari app and html page loaded from safari app extension resources folder

I'm trying to build a simple safari app extension. On about:blank I load a html page from resources folder of extension. Following is the code for that. //script.js - injected script if(window.location.href=="about:blank"){ window.location.href…
moghya
  • 854
  • 9
  • 18
5
votes
3 answers

How to get active tab in a Safari App Extension?

When I follow the Apple example I always get a nil activeTab: override func toolbarItemClicked(in window: SFSafariWindow) { // This method will be called when your toolbar item is clicked. window.getActiveTab(completionHandler: {…
pvieito
  • 117
  • 2
  • 8
4
votes
0 answers

How to get the state(enabled/disabled) of IOS Safari extension?

This SO is about how to get the state of a macOS safari extension. Wondering how it can be done with IOS ? (In its app container aka via swift) P.S: the mac code won't work on IOS as it gives: Cannot find 'SFSafariExtensionManager' in scope which…
4
votes
1 answer

How to get current active window using Swift and Cocoa

I'm currently developing a Safari App Extension, that consists of two parts: A host status-bar only application The Safari extension Further the host application offers a global shortcut, which opens a popover in the status bar. However, I want to…
adur
  • 143
  • 1
  • 7
4
votes
1 answer

Detecting if Safari App Extension is installed and enabled

I have a Safari App Extension. Is there a way to detect from the containing app if the extension was successfully installed and enabled in Safari? The documentation leaves a lot to be desired…
zoul
  • 102,279
  • 44
  • 260
  • 354
4
votes
0 answers

Can not override safari's default search in safari app extension?

I am developing safari app extension in Xcode using swift language to take over default search to my site. I have updated info.plist file to inject script.js file in every page as using SFSafariContentScript. I have tried using below code in…
3
votes
0 answers

How to get URL of active tab from popup.js with Safari iOS App Extension in iOS 15?

I'm developing Safari App Extension for iOS 15.0+ and I need to get URL of active tab in popup.js and display. Here is how I do that in popup.js: document.getElementById("appresponse").innerHTML =…
Serge
  • 2,031
  • 3
  • 33
  • 56
3
votes
1 answer

Update Safari App Extension Content Blocker list

When creating a native content blocker from a Safari App Extension, how do I update the static JSON list after the plugin has loaded? The only way I can see right now is to deploy a whole new version of the app which wouldn't update automatically…
Kevin Ghadyani
  • 6,829
  • 6
  • 44
  • 62
1
2 3 4 5 6