Questions tagged [wkwebviewconfiguration]
173 questions
67
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
- 826
- 1
- 6
- 10
43
votes
14 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
- 2,357
- 1
- 23
- 29
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…

Rogers Sampaio
- 614
- 1
- 9
- 15
13
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
- 351
- 1
- 2
- 10
13
votes
6 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
- 890
- 2
- 15
- 26
9
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
- 2,209
- 3
- 22
- 45
9
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,311
- 2
- 15
- 21
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…

spp
- 103
- 1
- 15
7
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
- 397
- 4
- 19
7
votes
1 answer
How do i copy everything from one WKWebView to a new WKWebView
I'm trying to copy all loaded data from one WKWebView to a new WKWebView so all content would be loaded when new webView is presented.
Any suggestion how to do this or what would be the best approach to this?

PashaN
- 444
- 1
- 4
- 16
7
votes
2 answers
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
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
- 792
- 10
- 16
7
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…

Avba
- 14,822
- 20
- 92
- 192
6
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…

arige maheswari
- 61
- 3
6
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,043
- 1
- 8
- 20