6

With iOS 15, Apple had made it possible to create Safari extension for iOS as well. I'm currently in the process of bringing an existing macOS Safari extension to iOS. My problem is that there doesn't seem to be the option to send a message from the host app to the extension. It is possible to answer a request from the extension through the beginRequest(with:) function. However, I actively need to send a message to the extension after an user action. In macOS, this can be done through the dispatchMessage(withName:toExtensionWithIdentifier:userInfo:completionHandler:) function as described here: https://developer.apple.com/documentation/safariservices/safari_web_extensions/messaging_between_the_app_and_javascript_in_a_safari_web_extension. This function is unfortunately not available for iOS.

Would greatly appreciate any ideas for solving this problem.

Til Jordan
  • 79
  • 2

1 Answers1

2

You can enable permission ["nativeMessaging"] in manifest file of the safari extension Use appGroup to store data between the extension and your application. In SafariWebExtensionHandler, you can response appGroup Data to the message called from any extension javascript file.