Meet Safari Web Extensions on iOS

RSS for tag

Discuss the WWDC21 session Meet Safari Web Extensions on iOS.

Posts under wwdc21-10104 tag

1 result found
Sort by:

Post

Replies

Boosts

Views

Activity

Programmatically open popup in Safari Web Extension
I have a Safari web extension that needs the ability to open the popup when the user interacts with a modal coming from the content script. There is a native message handler that comes with the safari web extension when you first create it: import SafariServices import os.log class SafariWebExtensionHandler: NSObject, NSExtensionRequestHandling { func beginRequest(with context: NSExtensionContext) { let item = context.inputItems[0] as! NSExtensionItem let message = item.userInfo?[SFExtensionMessageKey] os_log(.default, "Received message from browser.runtime.sendNativeMessage: %@", message as! CVarArg) let response = NSExtensionItem() response.userInfo = [ SFExtensionMessageKey: [ "Response to": message ] ] print("hit") context.completeRequest(returningItems: [response], completionHandler: nil) } } I have the permissions to send a native message, I've seen some examples online where you can access the SFSafariApplication module from SafariServices and open the popover. But I can't seem to access SFSafariApplication in this module.
1
0
1.1k
May ’24