You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Any suggestions on how to preload when creating a Web view dynamically, e.g. in response to window.open()? I'm loading third-party content, so I don't know if/when the content wants to open another page.
public func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration,
for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? {
// Added an initializer to accept an existing configuration
let newWebView = WKCookieWebView(configuration: configuration)
if let url = navigationAction.request.url {
// Doesn't work, probably because we have to return the WebView synchronously,
// before we have a chance to preload. Loading later doesn't work.
WKCookieWebView.preloadWithDomainForCookieSync(urlString: url.absoluteString) {
newWebView.load(navigationAction.request)
}
}
// Add webview to tab list
myDelegate?.didOpenNewWebView(for: url)
return newWebView
}
The text was updated successfully, but these errors were encountered:
Nice work!
Any suggestions on how to preload when creating a Web view dynamically, e.g. in response to
window.open()
? I'm loading third-party content, so I don't know if/when the content wants to open another page.The text was updated successfully, but these errors were encountered: