I am developing safari app extension in Xcode using swift language to take over default search to my site.
I have updated info.plist
file to inject script.js file in every page as using SFSafariContentScript
.
I have tried using below code in script.js file to add event to default search box, but its not working(It was working in legacy Safari extension).
safari.application.addEventListener("beforeSearch", getSearchText, true);
function getSearchText(e) {
alert("hi, this is from search box");
}
Does safari app extension have support to adding events to search bar ? Any help on this is appreciated.
Thanks in Advance!