I have an HTML file in Safari App Extension bundle
I want to load this file in this method.
override func page(_ page: SFSafariPage, willNavigateTo url: URL?) {}
Please use this code
override func page(_ page: SFSafariPage, willNavigateTo url: URL?) {
if (url?.absoluteString.hasPrefix("safari-extension://") ?? true) {
return
}
DispatchQueue.main.asyncAfter(deadline: .now() + .milliseconds(1000)) {
page.getContainingTab { tab in
SFSafariExtension.getBaseURI { baseURI in
guard let baseURI = baseURI else { return }
tab.navigate(to:baseURI.appendingPathComponent("testHTML.html"))
}
}
}
}