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
23
votes
6 answers

How to add Activity Indicator to WKWebView (Swift 3)

I have a wkwebview in my app, and I want to add an activity indicator to it. I want it to where it appears when the webview is loading and disappears whenever it is finished loading, it disappears. Can you give me some code to do this? Here's my…
iFunnyVlogger
  • 437
  • 1
  • 6
  • 17
23
votes
2 answers

When can I use a SFSafariViewController, WKWebView, or UIWebView with universal links?

In the Universal Links section of the iOS App Search Programming Guide, Apple says: If you instantiate a SFSafariViewController, WKWebView, or UIWebView object to handle a universal link, iOS opens your website in Safari instead of opening your…
Heath Borders
  • 30,998
  • 16
  • 147
  • 256
23
votes
4 answers

iOS 9 ... Are WebView(s) exempt from the App Transport Security Exceptions (ATS) rules that block insecure HTTP hosts?

In iOS 9, Apple is blocking insecure HTTP connections for apps, unless specific hosts are whitelisted. http://ste.vn/2015/06/10/configuring-app-transport-security-ios-9-osx-10-11/ Are WebView(s) exempt from these rules for obvious reasons, or are we…
Ben Guild
  • 4,881
  • 7
  • 34
  • 60
23
votes
2 answers

WKWebView does not finish/timeout when there is no internet access

There is a remote Javscript asset tag on a local HTML page I'm navigating to via WkWebView that never finishes downloading (in both the case that the iOS device is not connected to the internet, or the device's internet is too slow). Unfortunately,…
Eternal Rubyist
  • 3,445
  • 4
  • 34
  • 51
23
votes
7 answers

Launching phone/email/map links in WKWebView

KINWebBrowser is an open source web browser module for iOS apps. I recently upgraded KINWebBrowser to use WKWebView to begin phasing out UIWebView. This yields significant improvements, but: Problem: WKWebView does not enable users to launch links…
dfmuir
  • 2,048
  • 1
  • 17
  • 14
22
votes
4 answers

How to inject JavaScript callback to detect onclick event, using iOS WKWebView?

I'm using a WKWebView to show a website which has some HTML that includes three buttons. I want to run some Swift code in the native app when a specific button is clicked. About the HTML The three buttons look like this:
Aaron Brager
  • 65,323
  • 19
  • 161
  • 287
22
votes
5 answers

WKWebView not loading webpage - renders blank screen in Swift

This code is supposed to load the Apple homepage, but instead shows a blank screen. This happens with both HTTP and HTTPS URLs. Code: import UIKit import WebKit class WebViewController: UIViewController, WKUIDelegate{ var webView:…
Shrikant Chidgopkar
  • 695
  • 1
  • 6
  • 13
22
votes
2 answers

Service Workers unavailable in WKWebView in iOS 11.3

Service Workers were available in WKWebView in iOS 11.3 betas, but do not appear to be available in the final GM version of iOS 11.3. Does anyone know how to re-enable Service Workers in WKWebView on iOS?
Andrew Ebling
  • 10,175
  • 10
  • 58
  • 75
22
votes
3 answers

Does webKit in iOS 11 (Beta) support WebRTC?

I have a URL that is working fine with Safari on iOS11 (Beta) Audio/Video is working fine. But when I load this URL with WKWebView it gives me an error "Incompatible Browser" and when I check my browser version in WebKit it shows "WebKit based…
adarshk
  • 338
  • 1
  • 2
  • 10
22
votes
6 answers

How to prevent WKWebView to repeatedly ask for permission to access location?

I have a WKWebView in my app and when I start browsing www.google.com or any other website that requires location service, a pop up window appears, asking for the permission to access the location of the device even if I have already accepted to…
Randy
  • 4,335
  • 3
  • 30
  • 64
22
votes
2 answers

WKWebView isn't clickable outside it's contentInset

I have an app with a UIWebView and I need to change it into WKWebView. Everything works perfectly, except when the webView needs to be with contentInset that is not 0. The problem is, the WKWebView doesn't receive touches outside of the bounds of…
oren
  • 3,159
  • 18
  • 33
21
votes
5 answers

how to use iOS 13 darkmode for wkwebview

I was working for iOS 13 with Xcode 11 beta. Is there any way to support dark mode on web views? I have created a color set for all the other views except WKWebviews. How to change web view background and text color for dark mode?
Vinu David Jose
  • 2,569
  • 1
  • 21
  • 38
21
votes
4 answers

WKWebView constrains issue when keyboard pops up

When an input in WKWebView gets focused a constraints error pops up. Code: class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad(); let wv = WKWebView(frame: CGRect(x: 100, y: 100, width: 100,…
mnemon1ck
  • 420
  • 3
  • 12
21
votes
3 answers

WKWebView function for detecting if the URL has changed

Is there a function for the WKWebView class that allows you to detect whenever the URL of that WebView has changed? The didCommit and didStartProvisionalNavigation functions don't always seem to fire when working with certain elements within the…
JDev
  • 5,168
  • 6
  • 40
  • 61
21
votes
4 answers

Enable dragging in UIWebView / WKWebView

Trello, on the desktop website, allows you to drag elements around like this: However, when using Safari on iOS, this doesn't work. It either selects the element or pops up a sheet. If I present this in a UIWebView or WKWebView, can I make the…
cannyboy
  • 24,180
  • 40
  • 146
  • 252