Reputation: 102
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 unfortunately couldn't find anything related to these events there.
Can anybody please help me with similar APIs for Safari App Extensions as we had in old Safari JS Extensions.
Upvotes: 6
Views: 1003
Reputation: 21
Starting Safari 13, Apple added an API for page navigation notifications.
In your SafariExtensionHandler.swift
, you can now override func page(_ page: SFSafariPage, willNavigateTo url: URL?).
Source: https://developer.apple.com/documentation/safari_release_notes/safari_13_release_notes
Upvotes: 1
Reputation: 611
Unfortunately, there is not equivalent in Safari App Extension. The only thing you can do is catching a new tab id displayed through validateToolbarItem.
Or try to add a content or network filter in your App...
Upvotes: 0