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
79
votes
7 answers

iOS WKWebView not showing javascript alert() dialog

I am having some trouble getting a WKWebView in iOS 8 to display an alert dialog that is called from Javascript. After creating a standard WKWebView and loading an HTML file, I have a button on the page that creates a simple alert with some text.…
Charlie
  • 803
  • 1
  • 6
  • 5
77
votes
6 answers

iOS11 WKWebview crash due to NSInvalidUnarchiveOperationException

With ObjectiveC I am developing a SingleView app targeting iOS 11 having one view controller/view. In the Main.storyboard on top of the view I've dropped a WebKit View (WKWebView). I am seeing a crash in both the Simulator and on an iPhone 6…
dmind
  • 815
  • 1
  • 6
  • 9
76
votes
1 answer

iOS 13 - WkWebView: audio stops when in background

I've an app that uses WkWebView to play audio from Soundcloud, on iOS 13 Beta 6 the audio stops when the app is not in foreground, even when Audio is on in Background Modes. When starting the playback this assertion is thrown: Error acquiring…
76
votes
1 answer

Suppress WKWebView from scaling content to render at same magnification as UIWebView does

Problem Using WKWebView in place of UIWebView, I noticed that the contents of the WKWebView were massively scaled down as compared to my UIWebView. I'd like the WKWebView to stop doing that, and just respect my CSS values literally, the way…
idStar
  • 10,674
  • 9
  • 54
  • 57
75
votes
14 answers

How to remove cache in WKWebView?

Any one worked with WKWebView and tried to clear cache? If yes, how to do it? Any example? P.S. : Normal NSURLCache is not working.
Sravan
  • 1,891
  • 4
  • 23
  • 28
74
votes
7 answers

WKWebView open links from certain domain in safari

Within my app I am want to open links from within my domain (e.g.: communionchapelefca.org) in WKWebView but then have links from other domains open in Safari. I would prefer to do this programmatically. I have found a few solutions on Stack…
Greg Williams
  • 1,109
  • 3
  • 10
  • 13
72
votes
9 answers

How to Migrate to WKWebView?

I'm trying to understand how to make use of the new WKWebView in iOS8, can't find much information. I've read: http://developer.telerik.com/featured/why-ios-8s-wkwebview-is-a-big-deal-for-hybrid-development/ http://nshipster.com/wkwebkit/ But how…
Daniel Åkesson
  • 1,330
  • 1
  • 12
  • 21
71
votes
7 answers

The font looks like smaller in WKWebView than in UIWebView

I changed UIWebView to WKWebView, however, with the same html, the font in WKWebView looks like smaller than in UIWebView. I don't want this happen, so is there any way to avoid this change?
无夜之星辰
  • 5,426
  • 4
  • 25
  • 48
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
65
votes
4 answers

Get HTML from WKWebview in Swift

I log into a website using WKWebView and now i would like to parse the html of the website. How can I access the websites html in swift? I know how it works for a UIWebView but not for WKWebView. Thanks for your help!
MotoxX
  • 917
  • 1
  • 7
  • 13
65
votes
5 answers

Using custom fonts in WKWebView

I'm using custom fonts in my app. They are copied to bundle and hardcoded to appName-info.plist. This fonts works perfectly in the whole app and in UIWebView. Im loading htmlString [webView loadHTMLString:htmlString baseURL:nil]; I use this fonts in…
Sashke
  • 659
  • 1
  • 5
  • 4
63
votes
2 answers

In Xcode 14 & iOS 16 purple warnings starting with 'This method should not be called on the main thread as it may lead to UI unresponsiveness.'

When loading the URL in WKWebView, it leads to a security warning and later app gets crashes. Warning in UIApplicationMain - This method should not be called on the main thread as it may lead to UI unresponsiveness. How can I resolve this issue?
PrasathBabu
  • 4,716
  • 4
  • 19
  • 35
62
votes
21 answers

Disable magnification gesture in WKWebView

I'm looking for a way to disable the "pinch to zoom" magnification gesture on the iOS implementation of WKWebView. There is a magnification BOOL property available for OS X but it doesn't seem to be available on iOS. WKWebView.h #if…
Kevin
  • 3,111
  • 1
  • 19
  • 26
62
votes
12 answers

Transparent background for WKWebView

In my app I wish to make the WKWebView with transparent background, so the view behind (an ImageView) can show through as background picture. webView!.opaque = false webView!.backgroundColor = UIColor.clearColor() The code above works fine…
Lim Thye Chean
  • 8,704
  • 9
  • 49
  • 88
62
votes
7 answers

Call JavaScript function from native code in WKWebView

Using a WKWebView in iOS 8, how can I run a JavaScript function from the native side or otherwise communicate from the native side to JavaScript? There doesn't appear to be a method akin to UIWebView's stringByEvaluatingJavaScriptFromString:. (I can…
Sophie Alpert
  • 139,698
  • 36
  • 220
  • 238