Questions tagged [wkwebview]

A WKWebView object displays interactive web content. It is provided by Apple's WebKit which is available for macOS, iOS and tvOS as well.

A WKWebView object displays interactive web content. It is provided by Apple's Open Source Project WebKit and is available for macOS, iOS and tvOS as well.

Links:

3852 questions
27
votes
3 answers

Displaying activity indicator on WKWebView using swift

I am working on the following code and trying to show an activity indicator in the view whilst the page is loading.. I tried to implement the WKNavigationDelegate methods but I am failing as nothing shows. Any suggestions on how to fix this? I am…
mm24
  • 9,280
  • 12
  • 75
  • 170
27
votes
3 answers

Is WKWebView designed as a replacement of UIWebView?

Asking this questions as I am not sure why Apple introduced WKWebView without deprecating UIWebView. It is important to have an idea as I am programming a large code base and need to make an informed / fact based decision. Are there any reason for…
mm24
  • 9,280
  • 12
  • 75
  • 170
26
votes
1 answer

WKWebView is trying to run on background, although it's closed and should be disposed

I have a simple WKWebView in a UIViewController container in the application. User will open this UIViewController container with WKWebView, and then will eventually close it with navigation "Back" item. The navigation item disposes container and…
timbre timbre
  • 12,648
  • 10
  • 46
  • 77
26
votes
2 answers

WKWebView on link click listener?

Does there exist something like a onLinkClickListener in the WKWebView class? I tried googling it but found nothing, I also found some unanswered questions on stackoverflow of simillar type. The reason I need a linkClickListener is that, when I…
Samuel Kodytek
  • 1,004
  • 2
  • 11
  • 23
26
votes
4 answers

Swift iOS Cache WKWebView content for offline view

We're trying to save the content (HTML) of WKWebView in a persistent storage (NSUserDefaults, CoreData or disk file). The user can see the same content when he re-enters the application with no internet connection. WKWebView doesn't use…
Cristi Ghinea
  • 474
  • 1
  • 7
  • 20
25
votes
1 answer

WKWebView doesn't run JavaScript when on background

I noticed that sometimes when the webview is moved to background (have another view controller on top), it stops JavaScript functions execution, and executes them only when returning back to foreground. here a thread with a similar issue but most of…
ItayAmza
  • 819
  • 9
  • 21
25
votes
5 answers

How to load URL on WKWebView?

I am trying to load URL on WKWebView which contain the CSV file. When I tried it loading normally it was giving me an error: 'The file format is not supported / it might be corrupted'. Even mobile safari is also giving me the same error. Then I…
Jarvis The Avenger
  • 2,750
  • 1
  • 19
  • 37
25
votes
6 answers

WkWebKit - javascript on loaded page finds window.webkit is undefined

I'm experimenting with WkWebKit talking back and forth between app and page. I can get javaScript to execute fine using WkWebView evaluateJavascript method, but when I try to execute window.webkit.messageHandlers.myHandler.postMessage('hello…
Brian B
  • 1,509
  • 3
  • 20
  • 29
24
votes
3 answers

WkWebView Evaluatejavascript returns unsupported type error

I'm sending a value to javascript function and get a result. However, I'm getting "Error Domain=WKErrorDomain Code=5 "JavaScript execution returned a result of an unsupported type" UserInfo={NSLocalizedDescription=JavaScript execution returned a…
Emre Önder
  • 2,408
  • 2
  • 23
  • 73
24
votes
2 answers

WKWebView catch HTTP error codes

When i return any http error from my page (currently 401, but i tried also with 404 and so on) http://min60.com/__personal/e401.php the delegate callbacks of the WKWebView don't return an error - (void)webView:(WKWebView *)webView…
Peter Lapisu
  • 19,915
  • 16
  • 123
  • 179
24
votes
6 answers

WKWebView does not load https URL?

I have a WKWebView which should load the following url: https://buchung.salonmeister.de/place/#offer-details-page?id=907599&venueId=301655 Her is the code I use: import UIKit import WebKit class MMWKBrowserController: UIViewController { …
Michael
  • 32,527
  • 49
  • 210
  • 370
24
votes
5 answers

Detect if page is loaded inside WKWebView in JavaScript

How can I reliably detect using javascript that a page is loaded inside a WKWebView? I'd like to be able to detect these scenarios: iOS & WKWebView iOS & Safari not iOS There is a similar question about UIWebView here. But it's quite old and I'm…
andr111
  • 2,982
  • 11
  • 35
  • 45
23
votes
0 answers

Required client entitlement required?

I have a wkwebview and I selected the checkbox 'inline playback' which is suppose to make any video in the wkwebview to not autoplay and stay in the webpage and not go full screen. This worked fine for me until my Xcode updated to 11! I now get the…
user10559318
23
votes
2 answers

WKWebView catch HTTP error codes with Swift 4

this question is identical to the following: WKWebView catch HTTP error codes; unfortunately the methods in Obj-C are not applicable to Swift 4, thus the cited WKNavigationResponse.response is no longer of type NSHTTPURLResponse so it doesn't have…
Francesco Piraneo G.
  • 882
  • 3
  • 11
  • 25
23
votes
3 answers

Handling JavaScript events in WKWebView

I'm trying to catch every onClick event in WKWebView. The website is working only with JavaScript so I cannot handle anything in: func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping…
Alex Crow
  • 429
  • 1
  • 6
  • 17