Questions tagged [wknavigationdelegate]

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.

Apple Developer Documentation

26 questions
0
votes
0 answers

WKWebView Delegate WKNavigationDelegate fails to set properly in production

We have detected in production that there are times when we try to set the WKNavigationDelegate of the WKWebView, but that even though the object we are assigning to the delegate is not nil and is a valid allocated instance of WKNavigationDelegate…
Mike
  • 155
  • 2
  • 13
0
votes
0 answers

How can I adjust the height of tableviewcell based on the content for wkwebview

I have an issue regarding the height of UITableViewCell in Swift: The height of the UITableViewCell should be updated with the embedded HTML code in WKWebView, but it doesn't. import UIKit import WebKit class SocialVideoPlayer: UITableViewCell,…
0
votes
1 answer

Don't allow Webview to open hyperlinks correctly

For example, I write as follows, then it works correctly, that is, the content that comes is displayed as it should and when the user clicks the link, it doesn't redirect anywhere. extension AuthorizationContentView: WKNavigationDelegate { func…
Morozov
  • 4,968
  • 6
  • 39
  • 70
0
votes
1 answer

WKWebView in Xamarin.iOS - How to intercept requests for resources such as CSS and JS files?

I load an HTML file into a WKWebView on Xamarin.iOS using webView.LoadHtmlString(). This HTML file references a CSS file and a JS file, for example:
0
votes
1 answer

Completion handler passed to -[webView:decidePolicyForNavigationAction:decisionHandler:] was called more than once

Im getting this error when i press any link. Completion handler passed to -[webView:decidePolicyForNavigationAction:decisionHandler:] was called more than once The link open in safari but the app chrash. Any suggestions ? import UIKit import…
0
votes
1 answer

iOS WKWebView 's didCommitNavigation never called?

In my test code , I open the http://www.qq.com/ with a WKWebView . And I found that ,there will be 3 delegate methods to be called: webView:(WKWebView *)webView decidePolicyForNavigationAction: webView:(WKWebView *)webView…
0
votes
1 answer

How can I know if external app will be open or not when a link is loaded in WKWebView?

I have a WKWebView, the webview will load a link like https://qr.payme.hsbc.com/2/XXXXYYYZZZ. And there two possible results when the link is loaded, case 1 is an app called Payme will be opened when user has installed Payme app; case 2 is webview…
Season
  • 1,178
  • 2
  • 22
  • 42
0
votes
1 answer

Unable to open external link in safari using WKWebView

I am migrating from UIWebView to WKWebView. Need to load HTML content in WKWebView everything is working fine but the problem is unable to open link in the external safari browser after a click on any link from WKWebView. I used below…
0
votes
1 answer

WKWebView intercept local file requests

I have a WKWebView in my iOS 11+ app where I need to load custom HTML from local in-memory HTML. I can accomplish this by using webView.loadHTMLString or webview.load(data), which is working fine. This HTML references some required .js/.css/.png…
Henrik
  • 444
  • 4
  • 14
0
votes
1 answer

WKWebView is empty if I implement decidePolicyFor navigationAction, loads correctly if I remove the function

This is in xcode 10.3, swift 5 I'm trying to load some web content using WKWebView. I have a class that is just NSObject, which implements the WKNavigationDelegate class. I create the web view Set the navigationDelegate Load the web view If I…
0
votes
1 answer

Saving html data in variable from completion handler in Swift WKWebView

I'm trying to scrape data from a website, and the data I want is in a span tag. So far, what I've done is: var str: Any? webView.evaluateJavaScript("innerDoc.getElementById(spanId).innerHTML", completionHandler: { (html: Any?, error: Error?)…
1
2