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
0
votes
1 answer

Get event listener for newtab open/close in new safari app extension in xcode 11

I am new to Safari browser extension development. My requirements are below. Show user signup screen on clicking the toolbar item for first time and save user details in local storage. Get callbacks for new tab open/close, active tab details,…
Prasad
  • 129
  • 1
  • 1
  • 10
0
votes
1 answer

Click HTML link programmatically in JavaScript injected via Safari App Extension

I'm writing a Safari App Extension to automate logging into a Citrix web portal. My injected JavaScript needs to do two things. First, there is an HTML form to submit (with name/password). That works just fine and takes me to another page with an…
0
votes
1 answer

Safari app extension popover not calling table view notification methods

I want to include a view-based NSTableView in the popover of a Safari App Extension. Starting with the default project in Xcode, I made the SFSafariExtensionViewController the delegate and datasource for the table view as it is the only content on…
Rebecka
  • 1,213
  • 8
  • 14
0
votes
1 answer

What is the best way to set global settings for Safari app extension?

As this official document said, I put safari.extension.settings.test = "test" in my injected script, and it didn't work with an error: TypeError: undefined is not an object (evaluating 'safari.extension.settings.test = "test"') And I noticed that…
yuan
  • 1,701
  • 2
  • 13
  • 24
0
votes
0 answers

Should I worry about Safari shutting down roughly 30 seconds after building and running my app extension?

I'm in the process of porting over the logic from the background scripts of a Chrome/Firefox web extension to a Safari App Extension. I'm very new to Xcode, so it's taking some time learning how to interpret and confront the issues I'm…
deelydian
  • 93
  • 1
  • 8
0
votes
1 answer

How to listen web page postMessage event in WKWebview?

I make my WKWebview load a web page like this: class SafariExtensionViewController: SFSafariExtensionViewController, WKNavigationDelegate { static let shared = SafariExtensionViewController() var webView: WKWebView! override func…
yuan
  • 1,701
  • 2
  • 13
  • 24
0
votes
1 answer

Unable to check time elapsed with Calendar.current.dateComponents

I want to check how many seconds passed since one timestamp to now. I have this: Calendar.current.dateComponents([.second], from: userInfo?["timestamp"], to: Date()).second! > preferences["secsToWait"] But I'm getting this error: Type 'Any' has no…
Cornwell
  • 3,304
  • 7
  • 51
  • 84
0
votes
1 answer

Safari App Extensions issue, maybe authorisation

There is something that I don't understand: I've created a new project with a Safari Extension App in the macOS tab. I've allowed unsigned extension to be installed in Safari. So when I'm running the extension, I open the Safari Preferences and…
0
votes
1 answer

How can I debug my Safari App Extension when I load it from electron?

I have an Electron App that loads a Safari App Extension in the Safari Browser. When I open the browser, I can see my extension listed in Safari -> Preferences... -> Extensions. As soon as I enable it, I see the Toolbar Icon appear then…
RawiSader
  • 21
  • 7
0
votes
1 answer

Safari app extension: change FROM field in preferences pane

do you know where I can change this field in safari app extension project? (I am not writing 1password extension, this is just an example image) From my findings it looks like the name is name of containing app. But I'd like to change that. Is it…
0
votes
1 answer

Safari App Extension , How to load local html page from extension?

I have an HTML file in Safari App Extension bundle I want to load this file in this method. override func page(_ page: SFSafariPage, willNavigateTo url: URL?) {}
Imran
  • 3,045
  • 2
  • 22
  • 33
0
votes
1 answer

Safari App Extensions: Can the injected script load resources from the app bundle?

I have a Safari App Extension that injects a script into the host page. From that injected script, is it possible to load resources such as images or stylesheets from the main app bundle? (I mean directly, without sending messages between the two.)
zoul
  • 102,279
  • 44
  • 260
  • 354
0
votes
1 answer

How to send messages to the tab after page load in native safari app extension

In native safari extension,How to call dispatchMessageToScript after page loaded , In chrome we are using " chrome.tabs.onUpdated.addListener(listener);” function in background script and this is giving us tab URL and status with ‘complete’ then we…
0
votes
1 answer

How i can send message to the Injected Script on page from SafariExtensionHandler

I can send message when received message in override func messageReceived with from page prop and dispatchMessageToScript method, but I don't understand how can I do it in injectOpenWelcomeTab method. Thanks import SafariServices class…
0
votes
1 answer

Missing icon in Mac App Store review screen

I have a Safari App Extension that uses SKStoreReviewController to request the Mac App Store rating screen: The screen looks like it should have the app icon on the left side, but it doesn’t. I’ve tried setting ASSETCATALOG_COMPILER_APPICON_NAME in…
zoul
  • 102,279
  • 44
  • 260
  • 354