WKNavigationDelegate
is a protocol in WebKit. It can be used from macOS and iOS as well. It helps implementing behaviors triggered in a WKWebView
during navigation, including accepting, loading and completing a request.
Questions tagged [wknavigationdelegate]
26 questions
32
votes
3 answers
Get the current full URL for WKWebView
Is there a way to get the FULL URL loaded by a WKWebView for every request?
webView:didFinishNavigation:
Works only for mainFrame navigations and does not provide a URL request parameter.
How do I get the FULL URL just like in…

i-konov
- 842
- 1
- 7
- 19
4
votes
2 answers
Stop navigation WKWebview
This is my situation:
I have a view controller within a WKWebView. This webview starts with a page "A". In this page there are some links (href) and I want that for some of these links must open in the external browser.
For this reason I set the…

gianni rodari
- 117
- 3
- 7
3
votes
3 answers
How do I convert a WKScriptMessage.body to a struct?
I set up the WKScriptMessageHandler function userContentController(WKUserContentController, didReceive: WKScriptMessage) to handle JavaScript messages sent to the native app. I know ahead of time that the message body will always come back with the…

rawbee
- 2,946
- 3
- 18
- 22
3
votes
0 answers
WKWebView's didFinish delegate method is taking too long to receive the callback
I have a WKWebView inside my UITableViewCell. I configure my webview with an HTML string as follows:
webView.loadHTMLString(myHTMLString, baseURL: URL(string: "http://www.myPage.com"))
I am expecting to receive the callback in the following…

Aashima Anand
- 31
- 3
2
votes
1 answer
SwiftUI Web View unable to go back and forward
I am using WebView for loading the html into view . I added the forward and back button to go back and forward with require code but the problem is when I enter the url and click more link , I do not see the back button or forward button is enable…
user8705895
2
votes
0 answers
How to intercept (see) all requests of a site written in React in WKWebView for iOS 13 and higher?
I can't intercept all requests, I tried to use WKNavigationDelegate, schemeHandler and some repositories, but nothing is working. Is there any way to get them?

Igor Belobrov
- 21
- 1
2
votes
1 answer
Unit testing WKNavigationDelegate functions swift
I have a UIViewController that implements some WKNavigationDelegate functions, and I want to unit test the logic in these functions. Here's an example:
func webView(_ webView: WKWebView,
decidePolicyFor navigationAction:…

akshay dibe
- 23
- 2
1
vote
1 answer
How to call a function inside WebView from the menu bar item in SwiftUI?
so I'll keep it short. I have the following function inside my WKNavigationDelegate:
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
DispatchQueue.main.asyncAfter(deadline: .now() + 7.5) {
…

alex
- 118
- 1
- 6
1
vote
0 answers
Error Domain=WebKitErrorDomain Code=102 "Frame load interrupted" iOS WKwebview WKnavigationdelegate
I´m working on an app that will show a website. But I'm running into errors when loading the website in app. I´ts also working perfectly fine on android.
The error:
WebPageProxy::didFailProvisionalLoadForFrame: frameID = 3, domain…

levios3114
- 71
- 1
- 6
1
vote
1 answer
WKWebView does not call `didFinish` delegate method
I am implementing a custom WKWebViewClass. The init() is settings the navigationDelegate to self, and starting the load. However, didFinish is never called. I am getting a didFailProvisionalNavigation error
didFailProvisionalNavigation The operation…

Will
- 11
- 2
1
vote
1 answer
WKWebView Navigation Delegate Not Called
I am having difficulty getting a WKWebview to call its delegate methods, namely the did finish one.
I am attempting something similar to this post generating a pdf report using html loaded into a WKWebView;
WKWebView not calling navigation delegate…

Lebowski1213
- 47
- 1
- 7
1
vote
1 answer
WKNavigationDelegate method is not called
I'm currently writing a web view application using WKWebView, which should show a custom error page when there is no internet connection while loading a page. I've tried to handle this by calling a method of WKNavigationDelegate, but it's never…

david
- 13
- 4
1
vote
0 answers
Xamarin.iOS WKWebView and WKNavigationDelegate custom renderer Intranet SharePoint links not working
I am working on one Xamarin forms app and I have created custom renderer to use native web views.
We have some intranet SharePoint URL links in web view content which is not working in iPhone real device. The public URL links are working fine but…

Sulay Joshi
- 195
- 2
- 9
1
vote
1 answer
Cocoa Swift: Error evaluateJavaScript Optional("A JavaScript exception occurred")
I'm loading WKWebView with a webpage and I'm trying to execute javascrip:
func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) {
webView.evaluateJavaScript("document.getElementById('someElement').innerText") { (result,…

user2924482
- 8,380
- 23
- 89
- 173
1
vote
1 answer
WKWebView is not scrolling the content to mapped HTML
I am working on the WKWebView to render the HTML in WKWebView.
My HTML has
This anchor tag will push my WKWebView to the content mapped to it.
My full HTML is :
…

Raghav Chopra
- 527
- 1
- 10
- 26