Questions tagged [wkwebviewconfiguration]

173 questions
4
votes
1 answer

WKWebview javascript works on simulator but doesn't work on device if the view isn't on the screen

I'm using a WKWebview to run javascript scripts. I am not using JSContext et.al since I need the javascript context to be able to perform XHTTP requests which aren't possible with JSContext alone. This view is not added to the view hierarchy and I…
Avba
  • 14,822
  • 20
  • 92
  • 192
4
votes
0 answers

wkwebview requiresUserActionForMediaPlayback not working

i have a wkwebview that goes into youtube and I would like to click on a video without it automatically throwing me into the video player. I tried stopping this in 3 different ways using the config.requiresUserActionForMediaPlayback = true in the…
stanley
  • 1,113
  • 1
  • 12
  • 26
4
votes
1 answer

Can multiple instances of WKWebView in the same app have a separate cookie store?

I have a couple of WKWebViews in my app. I don't want the cookies/auth to be shared between them. I tried using separate instances of WKProcessPool and WKWebViewConfiguration to initialize the other webview. It doesn't work. What am I doing wrong?
esh
  • 2,842
  • 5
  • 23
  • 39
3
votes
0 answers

WKWebview Authentication using token is not working - Swift

I want to open authorised url in WKWebview my application. I have tried all possible solution from stackoverflow and google but none of them working for me. if let url = myURL { var request = URLRequest(url: url) …
shraddha11
  • 783
  • 4
  • 17
3
votes
3 answers

Load html text in WKWebView

I use this code to load my html file with text in WKWebView: do { guard let filePath = Bundle.main.path(forResource: "\(readBookNumber)", ofType: "html") else { print ("File reading error") return } var…
User
  • 121
  • 1
  • 2
  • 11
3
votes
1 answer

How to disable auto-start AVPlayer in wkwebview video

I want to set alert like Safari, when user click on a video url then it will ask for to play or cancel. currently when I click on video url(a url inside of a loaded page) it directly play the video in AVPlayer. How do I implement it without…
Shivam Parmar
  • 1,520
  • 11
  • 27
3
votes
1 answer

Argument Type does not conform to expected type 'WKScriptMessageHandler'

I'm trying two-way integration between Swift and Javascript interfacing with SwiftUI. Here is interfacing WebKit with SwiftUI. import SwiftUI import WebKit struct ggWebView : UIViewRepresentable { let filePath: String func…
Lonaso
  • 55
  • 2
  • 5
3
votes
1 answer

Why window.close is not working for multiple windows

I have used Handling new window inside webview. I have used solution 2 from the mentioned link, Which was adding the new window to the subview. This solution provided in this link works pretty well. But the problem I faced here is when I open…
3
votes
0 answers

How do I implement Calendar Events from WKWebView into my iPhone?

I have a UIViewController in which a WKWebView is implemented. My problem is: I would like, because on the Websites URL is a button with a calendar event, import this into my app. In other words, if you push the pushed button a query appears in…
Shinox
  • 107
  • 12
3
votes
2 answers

"@TRUE" in Objective-C

Recently I saw this code: WKWebViewConfiguration *configuration = [[WKWebViewConfiguration alloc] init]; [configuration.preferences setValue:@TRUE forKey:@"xxxx"]; What does @TRUE stands for? I'm seeing this construct for the first time. I know…
Richard Topchii
  • 7,075
  • 8
  • 48
  • 115
3
votes
0 answers

How to enable cookies acceptance in WKWebView in ios

I have a native iOS app with WKWebView. Since i'm facing a session lost issue in iOS App. While app is idle for a long time. And i try to use it. I lost all session in my WKWebView. I hope cookies are lost , so session is lost. There is any way to…
Eldhose Elias
  • 389
  • 1
  • 6
  • 22
3
votes
1 answer

Disabling cookies in WKWebView

Is it possible at all to disable cookies and local storage in a WKWebView? Let's say that this is my setup, and I want to add something that disables them: import UIKit import WebKit class ViewController: UIViewController, WKUIDelegate { var…
Luoruize
  • 579
  • 2
  • 7
  • 25
3
votes
2 answers

programmatically change WKWebView content size

I added a WKWebView subview into a PhoneGap / Cordova 4.0+ app (via cordova-plugin-wkwebview-engine) and used programmatic AutoLayout constraints to get the WKWebView to size the same as the MainViewController's view. When I view the bounds of the…
3
votes
1 answer

WKWebView: How to local storage enable in iOS8

I'm trying to local storage enable. But in iOS8, I can't find how to do it. let configuration = WKWebViewConfiguration() if #available(iOS 9.0, *) { configuration.websiteDataStore = WKWebsiteDataStore.defaultDataStore() } else { //?? }
ysknsn
  • 89
  • 2
  • 10
3
votes
1 answer

Use shared WKWebViewCookies for a request

I have a few different WKWebViews inside my project they are all sharing cookies over a single WKProcessPool. Now I want to make a request on a REST API and need to send exactly that cookies from that WKWebViews to that API. Is there a way to get…
Joschka Schulz
  • 674
  • 1
  • 8
  • 18
1 2
3
11 12