Questions tagged [wkwebviewconfiguration]

155 questions
59
votes
4 answers

How to check if WkWebView finish loading in Objective-C?

I want to load HTML pages using WkWebView and I want to show the page just after it's finished loading. As long as it's loading I would like to show an activity indicator on an empty View. I create two view a loadingView and a wkWebView. While the…
faklyasgy
  • 736
  • 1
  • 5
  • 10
35
votes
13 answers

How to delete WKWebview cookies

For now I am doing like this NSHTTPCookie *cookie; NSHTTPCookieStorage *storage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; for (cookie in [storage cookies]) { [storage deleteCookie:cookie]; } But it is not working…
Pankaj Gaikar
  • 1,619
  • 1
  • 18
  • 23
16
votes
2 answers

WKWebview evaluateJavascript is not working, throws an error

I am trying to call an existent function from a remote site in a WKWebview: function addtext (text) { jQuery("#webviewtest").html(text); } With: [self.WebView evaluateJavaScript:@"addtext(\"This is a text from app\");" completionHandler:^(id…
12
votes
0 answers

Support third-party cookies in WKWebView

I want to support third-party cookies in an iOS application using WKWebView. Is there any way to support third-party cookies when the user has blocked all cookies in Safari's settings (Settings -> Safari -> Block Cookies -> Always)? I have tried…
Andection
  • 331
  • 1
  • 2
  • 10
11
votes
5 answers

Disable double-tap scroll on WKWebView

I have a custom keyboard with a WKWebView in full width and height. I have disabled the scroll via wkWebView!.scrollView.scrollEnabled = false but I still have a strange scroll behavior at double-tap on the bottom of the WKWebView. Here the…
Beny
  • 870
  • 1
  • 15
  • 26
8
votes
2 answers

WKWebview getAllCookies crash in iOS 11.3

We have recently migrated to WKWebview. We have added a listener for cookie change, to get the updated cookies and update our own store. - (void)cookiesDidChangeInCookieStore:(WKHTTPCookieStore *)cookieStore { [cookieStore…
7
votes
1 answer

How to disable autoplay for YouTube video in WKWebView?

I have simple ViewController with WKWebView configured as follows: webView.configuration.allowsInlineMediaPlayback = true webView.configuration.mediaTypesRequiringUserActionForPlayback = .video But right after loading a web page with YouTube video…
a-a-m
  • 96
  • 1
  • 5
7
votes
2 answers

Script message handler not working

I am trying to inject a custom WebKit script message handler. My controller is correctly loaded and the view as well. However, on the JS side (from the Safari console), window.webkit.messageHandlers is empty. Any idea why? My app is using iOS 8.1…
Adrien Cadet
  • 1,191
  • 1
  • 13
  • 21
6
votes
2 answers

How to embed WKWebView inside custom UIView properly?

In my project I have a view controller where i want to show WKWebView embedded inside another UIView titled viewForEmbeddingWebView that i've created in a storyboard (grey on the picture). I've implemented this logic in my ViewController: import…
Adelmaer
  • 1,849
  • 3
  • 15
  • 38
6
votes
2 answers

Capturing window.print() from a WKWebView

I'm trying to capture the window.print() javascript call from a WKWebView with my app to actually show a print dialog and allow them to print from a button presented on the page (instead of a button inside my app). Does anyone know the best way to…
Steve E
  • 712
  • 10
  • 16
6
votes
2 answers

WKUserScript not working

I want to inject a script using WKWebview API. For some reason it isn't working and I can't figure it out. I've tried debugging in Safari developer console and I can't find the JavaScript code in there either. Implementation Code as…
Avner Barr
  • 13,049
  • 14
  • 82
  • 152
5
votes
3 answers

Swift 4/5 setting adding proxy to WKWebview

I have looking for a way to set a proxy to WKWebview request with no luck. By another hand I have been able to set proxy to http request func createURLSessionConfiguration(_ host:String,_ port:String) -> URLSessionConfiguration { let config =…
5
votes
0 answers

wkwebview not detecting phonenumbers when loading the html content using javascript

wkdatdetectortypes = .all is not detecting any of the data like phone numbers, address etc. in wkwebview. This is happening only when loading the html string using javascript. If it is done using loadHTMLString, the data is detected properly. can…
5
votes
1 answer

How to fix "EXC_BAD_ACCESS" when creating WKPreferences variable in Swift 4

In my code, I have a part that creates a new WKWebView with a specific WKWebViewConfiguration, which in turn has a WKPreferences reference. All of this then gets added to the view of the application. The problem is that up until this point, my code…
MattChris
  • 197
  • 2
  • 15
5
votes
0 answers

iOS WKWebView Handle File Download

I am facing the following problem: In a web interface, file downloads are triggered with an anchor tag, like this: .. While Safari browser can handle this request and open a dialogue to handle the file, WKWebView…
Robert K.
  • 1,033
  • 1
  • 8
  • 20
1
2 3
10 11