In Safari app extension how to capture events of "beforeNavigate", "navigate" and "activate" similar to safari extensions events?

In Safari extension we have used these event listeners to capture URLs.


safari.application.addEventListener("beforeNavigate", PushURLS, true);

safari.application.addEventListener("navigate", handleNavigationEvent, true);

safari.application.addEventListener("activate", handleTabActivateEvent, true)


Is there any functions in Safari app extension to capture these events? How to capture those?

Accepted Reply

Instead of beforeNavigate and navigate, Safari App Extensions will be able to listen for when a page is about to perform a navigation.


https://developer.apple.com/documentation/safariservices/sfsafariextensionhandling/3238031-page


When the selected tab changes in a window, your toolbar item will be validated using:


https://developer.apple.com/documentation/safariservices/sfsafariextensionhandling/1639492-validatetoolbaritem


Is that something you could use?

Replies

Instead of beforeNavigate and navigate, Safari App Extensions will be able to listen for when a page is about to perform a navigation.


https://developer.apple.com/documentation/safariservices/sfsafariextensionhandling/3238031-page


When the selected tab changes in a window, your toolbar item will be validated using:


https://developer.apple.com/documentation/safariservices/sfsafariextensionhandling/1639492-validatetoolbaritem


Is that something you could use?