wkwebviewconfiguration

What is suppressesIncrementalRendering doing?

China☆狼群 提交于 2020-06-29 04:08:07
问题 I'm using the newest version of Xcode and Swift . I was googling around to make my KWWebView even faster and found the following: webConfiguration.suppressesIncrementalRendering = true Documentation says the following: A Boolean value indicating whether the web view suppresses content rendering until it is fully loaded into memory. But what does this mean? Does it mean, the html doesn't not get rendered and shown as long as not all resources like images and javascript files are completely

Manipulate paste content in WKWebView

微笑、不失礼 提交于 2020-04-18 05:47:28
问题 I need to manipulate the text that is pasted into a WKWebView (from any source) running an asynchronous operation that can take some time. My original idea was to use Javascript and the WKWebView configuration in order to get the onpaste event: WKUserContentController *wkUController = [[WKUserContentController alloc] init]; NSString *pasteJSSource = @"document.addEventListener('onpaste', function(){ window.webkit.messageHandlers.ComposerListener.postMessage('onpaste happened!'); })";

Update WKWebView Cookie Values

China☆狼群 提交于 2020-01-03 05:26:17
问题 My Requirement is to update the cookies that are set to WKWebView . I'm able to update the cookies in NSHTTPCookieStorage , but the same cookies are not reflected to WKWebView cookies(The update values are present in NSHTTPCookieStorage but are not set to WKWebView ) The following is code that i have used to set that cookies to AJAX calls. NSString *strURL = DASHBOARDURL; NSURL *url = [NSURL URLWithString:strURL]; NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init]; [request

iOS: evaluateJavaScript will not invoke function when parameter contains newline character

眉间皱痕 提交于 2019-12-25 08:16:11
问题 The goal is to invoke a callback function inside a web page contained inside a WKWebView . evaluateJavaScript breaks when its parameter contains the newline character, meaning the callback function never gets called. Why is this? userContentController(_ userContentController: WKUserContentController, didReceive message: WKScriptMessage) is invoked when the user presses a button on the web page. func userContentController(_ userContentController: WKUserContentController, didReceive message:

Get Javascript function response in iOS using Swift

给你一囗甜甜゛ 提交于 2019-12-21 23:11:20
问题 I am trying to figure out how to implement JavaScript functions inside my iOS app using swift platform . I have tried out the example code specified in the link https://tetontech.wordpress.com/2014/07/15/swift-to-javascript-and-javascript-to-swift-a-round-trip/ But i want in the same way like android is doing as specified in the link http://android-er.blogspot.in/2011/10/call-javascript-inside-webview-from.html Could you please help me out. Any help will deeply appriciated. 回答1: If you are

Why INSPECT ELEMENT or WEB INSPECTOR or developerExtrasEnabled (WkWebView) is not working in iOS While its working for OSX

谁说胖子不能爱 提交于 2019-12-20 06:27:42
问题 Here is the code snippet that facilitates the INSPECT ELEMENT in WkWebView preferences.setValue(true, forKey:"developerExtrasEnabled") Here is the screenshot of INSPECT ELEMENT working in OSX(right click) Right click is equivalent to Tap & Hold in iOS But I am not able to see anything like I see in OSX Here is the complete code if anybody wants to try 回答1: Its not possible to do in iOS as WKPreference is not key value coding-compliant for the key developerExtrasEnabled so we can't do this

Ionic 3 Response with status: 0 for URL: null

大城市里の小女人 提交于 2019-12-18 07:14:33
问题 I have an Ionic 3 app. I recently added the iOS platform. When i run it on iOS (emulator and device) all the server requests that has headers fail with the error "Response with status: 0 for URL: null" . On Android those requests works fine. If I do the requests without headers i get the expected response from server. I know the problem is with WKWebView and CORS . The server has the CORS configured correctly. I do the requests with @angular/http module. Let's see some code. This is my

iOS Objective-C LocalStore in WKWebView

雨燕双飞 提交于 2019-12-12 04:54:26
问题 I found this SO that gives an explanation of how to set local storage using javascript. I'm trying to translate it from Swift to Objective-C. For some reason it's throwing a fit at me like I'm missing a bracket but I can't seem to figure it out. Any ideas how to correctly translate that Swift to iOS? Here's what I have so far: - (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation { [webView evaluateJavaScript:@"localStorage.getItem(\"key\")" completionHandler:^

How to stop WKWebView from creating too many processes?

一世执手 提交于 2019-12-11 01:58:41
问题 I have a MacOS app that creates many NSViews of differing types, some of which contain WKWebViews. The Number of WKWebViews can become fairly large (dozens or more). The problem is that each of these WKWebViews creates several processes, as can be easily seen in Activity Monitor. When the number of processes becomes too large, the entire system essentially grinds to a halt: running apps still function slowly, but new apps can't be launched, the Finder stops working, and the system must be

Use shared WKWebViewCookies for a request

99封情书 提交于 2019-12-10 22:31:03
问题 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 the cookies? Everything I get are the cookies from the NSHTTPCookieStorage but they seem not really in sync with the cookies I use in the WKWebView. Or is there even the possibility to make a request that uses the WKProcessPool too? 回答1: 1) If your