Analogous WebExtension API that is available in AppExtensions (Safari)

In Safari AppExtensions we have this API made available

https://developer.apple.com/documentation/safariservices/sfsafariextensionhandling/3238030-contentblocker?changes=_8__2

optional func contentBlocker(withIdentifier contentBlockerIdentifier: String, blockedResourcesWith urls: [URL], on page: SFSafariPage)

Is there something made available to WebExtension given WebRequest blocking isn't available in Safari.

Answered by Engineer in 708047022

Safari Web Extensions have the DeclarativeNetRequest API, where you can specify rules in that format.

Check out https://developer.apple.com/documentation/safariservices/safari_web_extensions/blocking_content_with_your_safari_web_extension?language=objc for some information on that.

New in Safari 15.4, we added support for the getMatchedRules API. You can see some documentation about that at:

https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#method-getMatchedRules

Hope this helps!

Accepted Answer

Safari Web Extensions have the DeclarativeNetRequest API, where you can specify rules in that format.

Check out https://developer.apple.com/documentation/safariservices/safari_web_extensions/blocking_content_with_your_safari_web_extension?language=objc for some information on that.

New in Safari 15.4, we added support for the getMatchedRules API. You can see some documentation about that at:

https://developer.chrome.com/docs/extensions/reference/declarativeNetRequest/#method-getMatchedRules

Hope this helps!

Thank you!

Analogous WebExtension API that is available in AppExtensions (Safari)
 
 
Q