Display web content in windows and implement browser features using WebKit.

Posts under WebKit tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

WKWebView default SameSite value for cookies is different in iOS18
In iOS18, WKWebView's default cookie SameSite value is Lax. Prior to iOS18, the default value is None. Is this intentional, or a bug? This change is not documented anywhere. I made a sample XCode project (ViewController code below) to show this change. It loads www.apple.com into a WKWebView and prints cookies. That site has several cookies, but it only explicitly sets SameSite to None for one cookie, s_vi. Every other cookie relies on default WKWebView behavior. When looking at cookies, either in the console or in Safari's Web Inspector, the SameSite value differs. If older than iOS18, every cookie has SameSite of None. If iOS18, all cookies except s_vi have SameSIte of Lax. I also tried manually setting the following cookies: testCookie-none with SameSite set to None testCookie-lax with SameSite set to Lax testCookie-strict with SameSite set to Strict testCookie- with SameSite set to an empty string When looking at these cookies, testCookie-none and testCookie- have their SameSite of None if older than iOS18, but are both Lax in iOS18. So, it seems we cannot manually set the SameSIte to None either. I realize updating the server to return the SameSite value would resolve this. However, in my app where I'm struggling with this issue, that server is Salesforce. Only they can update their response headers. Since this change isn't documented by Apple, I am assuming it is a bug and not intentional. Are there any workarounds? Any input by Apple on a fix? Below is the ViewController code, and images of the cookies in Safari's Web Inspector. import UIKit import WebKit class ViewController: UIViewController, WKNavigationDelegate { var webView: WKWebView! override func loadView() { // Create WKWebView let config = WKWebViewConfiguration() webView = WKWebView(frame: .zero, configuration: config) // Allow inspection in Safari debugger webView.isInspectable = true // Track the request to load our website webView.navigationDelegate = self // Manually add four cookies: // testCookie-none with SameSite set to None // testCookie-lax with SameSite set to Lax // testCookie-strict with SameSite set to Strict // testCookie- with SameSite set to an empty string addTestCookies() view = webView } override func viewDidLoad() { super.viewDidLoad() // Load a website let urlString = "https://www.apple.com" self.webView.load(URLRequest(url: URL(string:urlString)!)) } // Once the website loads, print the cookies. func webView(_ webView: WKWebView, didFinish navigation: WKNavigation!) { WKWebsiteDataStore.default().httpCookieStore.getAllCookies { cookies in for cookie in cookies { print(cookie) } } } /* Manually add the following cookies for domain .apple.com testCookie-none with SameSite set to None testCookie-lax with SameSite set to Lax testCookie-strict with SameSite set to Strict testCookie- with SameSite set to an empty string In older iOS versions, both testCookie-none and testCookie- will have their SameSite as none. In iOS18, no cookie will have SameSite as None. */ func addTestCookies() { let httpCookieStore = WKWebsiteDataStore.default().httpCookieStore for sameSitePolicy in ["none", "lax", "strict", ""] { httpCookieStore.setCookie(HTTPCookie(properties: [ HTTPCookiePropertyKey.path: "/", HTTPCookiePropertyKey.name: "testCookie-"+sameSitePolicy, HTTPCookiePropertyKey.value: "1", HTTPCookiePropertyKey.domain: ".apple.com", HTTPCookiePropertyKey.secure: true, HTTPCookiePropertyKey.sameSitePolicy: sameSitePolicy ])!) } } }
0
0
4
21m
faulty Transparent Video in iPhone browsers
I need to play a Video with transparent background on our website. It works perfectly on Windows, Mac & Android (in all browsers). On iPhone however, no matter what Browser, The transparent parts of the video act almost like an "overlay", making everything behind it a lot brighter. This effect gets worse, the higher I set the iPhone screen brightness. This is of course not the behavior I'm looking for. The Video Element has two listed sources. One .WEBM (VP8 with alpha channel) and one .MP4 (HEVC with alpha channel). I am sure, that something is wrong with the MP4 file, but I don't understand why it works in Safari on Mac, but doesn't on iPhone. Shouldn't they both play the same File? Here is my workflow: masking the subject in DaVinci Resolve exporting as QuickTime - Apple ProRes 444 - "Export Alpha" using Shutter Encoder (v15.7) to convert the file to H.265 (.mp4) under "Advanced Features": Hardware acceleration to "OSX VideoToolbox" & check "Enable alpha channel" also converting the first file to VP8 (.webm) with "Enable alpha channel" then adding the Videos to the website like this: <video height="450px" autoplay loop muted playsinline disablepictureinpicture> <source src="(url of the mp4)" type='video/mp4; codecs="hvc1"'> <source src="(url of the webm)" type="video/webm"> </video> Here is how it looks on Safari (Mac) This is what it looks like in any browser on iPhone I have re-exported, re-converted and re-implemented it multiple times and I just can't get it to work on iPhone. Does anyone have an idea, what the cause could be, or what I can do differently?
2
0
41
55m
WKWebView Synchronous Ajax/XmlHttpRequest timeout
PLATFORM AND VERSION iOS Development environment: Other: Xamarin iOS App Run-time configuration: iOS 14.4.2 and above DESCRIPTION OF PROBLEM We are using WKWebView control in our application. It loads a page, wherein there is a code which gets triggered to execute a Synchronous Ajax/XmlHttpRequest. This request needs about 1 min time to complete, but it gets aborted after 10 secs. Observed in iPhone 6S 14.4.2. Also seen the same behavior in the latest version of iPhone and iPad OS. Need help on the below points: How can I extend this timeout? Making it an Asynchronous call would have regression. Hence the ask for any other alternative to extend this timeout. STEPS TO REPRODUCE In the WKWebView have a webpage, which gives a Synchronous ajax/XmlHttpRequest call to a Web API, which takes more than 10 seconds to complete. The Ajax call sample code is as below, which uses jquery: var startTime = performance.now(); $.ajax({ async: false, // Synchronous ajax call type: "POST", url: "http://testsite:8000/api/RunTestTimer", contentType: "application/json; charset=utf-8", data: JSON.stringify({ timeInSeconds: 15 }), // timeInSeconds is the parameter name in the Web API, which I used to run a timer on the server-side for the value passed to the ajax call dataType: "json", beforeSend: skelta.forms.utilities.addRequestHeaders }) .done(function (result) { var endTime = performance.now(); var message = "Request Successful (Time Taken to execute: " + ((endTime - startTime) / 1000).toFixed(3) + " secs; Type: " + "POST" + "; Async: " + "FALSE" + "; Timer: " + "15" + " seconds):" + JSON.stringify(result); console.log(message); }) .fail(function (result) { var endTime = performance.now(); var message = "Request Failed (Time Taken to execute: " + ((endTime - startTime) / 1000).toFixed(3) + " secs; Type: " + "POST" + "; Async: " + "FALSE" + "; Timer: " + "15" + " seconds):" + JSON.stringify(result); console.log(message); });
0
0
90
2d
iOS 18 HTML images are not loading in WKWebView
iOS 18 WKWebView images are not loading, no errors in older versions. The example while loading HTML is as follows. A problem occurs when you pull an image from a url. To get a URL image you need a cookie or something. I add them too, but it doesn't work on iOS 18. I get the error "An error occurred trying to load the resource." and a blue question mark on the screen. webView.configuration.websiteDataStore.httpCookieStore.setCookie(cookie) <html> <head> <style> body { font-family: -apple-system; margin: 0; padding: 0; text-align: center; } img { width: 100%; height: auto; } </style> </head> <body> <h1>Resim Görüntüleme</h1> <img src="https://xx.***.xx/example.png"> </body> </html> """
2
0
219
4d
WebView Loading Issue iOS 18.1
Since iOS 18.1 launched as a beta, we've been getting reports from end users on iPhone 15 Pro and iPhone 15 Pro Max specifically. They're reporting that our WebView is unable to load our local HTML content. I'm curious if anyone else has had their app or users run into this issue? So far I've tried installing the most recent XCode Beta 16B5014f and installed an 18.1 emulator, but our app worked fine. It's also working fine on all my real devices, but we don't have a 15 Pro to test on. I'm curious if this is related to the processor on these devices and how they are intended to support Apple's new AI coming in 18.1.
2
0
167
3d
First-Party-Cookies Retention Policy using Capacitor App
Hello, we built an ios app using the capacitor framework (app rendered in webview) and recently implemented a cookie based authentication mechanism. What we have no reliable information about is for how long these first-party cookies are stored and if/when they are cleared by some Apple policy. There is a lot of conflicting information out there and I want to reach out here to get some definitive information about this topic. For how long are first-party cookies persisted using ios webview via capacitor. Is there any way to influence that behaviour? Thank you very much. Best Regards Marcus
0
0
91
5d
Previously working projects fail
I have a small example project that ran on both the simulator and a connected iPhone but now it and all other projects are failing with the same error. I am using Xcode 16.0 on MacOS Sonoma 14.6.1., iPhone 11 with iOS 18. Thank you in advance. The error is: Failed to resolve host network app id to config: bundleID: com.apple.WebKit.Networking instance ID: Optional([_EXExtensionInstanceIdentifier: 1163B5D2-09D3-4704-9564-61099502138B]) WebContent process (0x114018680) took 1.375772 seconds to launch GPU process (0x1140a0630) took 1.228457 seconds to launch Networking process (0x114034d00) took 1.426249 seconds to launch 0x105820a20 - [pageProxyID=7, webPageID=8, PID=34786] WebPageProxy::didFailProvisionalLoadForFrame: frameID=1, isMainFrame=1, domain=NSURLErrorDomain, code=-1200, isMainFrame=1, willInternallyHandleFailure=0 Message from debugger: killed Below is the code from one of the examples: import UIKit import WebKit class ViewController: UIViewController { let webView: WKWebView = { let prefs = WKWebpagePreferences() prefs.allowsContentJavaScript = true let configuration = WKWebViewConfiguration() configuration.defaultWebpagePreferences = prefs let webView = WKWebView(frame: .zero, configuration: configuration) return webView }() override func viewDidLoad() { super.viewDidLoad() view.addSubview(webView) guard let url = URL(string: "https://google.com") else { return } webView.load(URLRequest(url: url)) //evaluate JavaScript DispatchQueue.main.asyncAfter(deadline: .now()+5){ self.webView.evaluateJavaScript("document.body.innerHTML") { result, error in guard let html = result as? String, error == nil else { return } print(html) } } } override func viewDidLayoutSubviews(){ super.viewDidLayoutSubviews() webView.frame = view.bounds } }
0
0
187
5d
Sandbox and WKWebView
When I run this program on iphone ( ios 18.0 with Xcode 16.0 (16A242d) ) I get these warnings from iphone ( not from the preview running ) : Could not create a sandbox extension for '/var/containers/Bundle/Application/7BAE-82-4A3-98D-75A49B/xxxx.app' Updated list with error: DownloadFailed Updated list with error: DownloadFailed Updated list with error: DownloadFailed Updated list with error: DownloadFailed Updated list with error: DownloadFailed The programe is simple : import SwiftUI import WebKit struct ContentView: View { let htmlContent = """ &lt;html&gt; &lt;head&gt; &lt;meta content="text/html; charset=UTF-8" http-equiv="content-type"&gt; &lt;meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"&gt; &lt;/head&gt; &lt;body&gt; &lt;h1&gt;Hello, World!&lt;/h1&gt; &lt;p&gt;This is a simple webpage displayed in a WebView.&lt;/p&gt; &lt;/body&gt; &lt;/html&gt; """ var body: some View { WebView(htmlContent: htmlContent) .edgesIgnoringSafeArea(.all) } } struct WebView: UIViewRepresentable { let htmlContent: String func makeUIView(context: Context) -&gt; WKWebView { let webView = WKWebView() webView.loadHTMLString(htmlContent, baseURL: nil) return webView } func updateUIView(_ uiView: WKWebView, context: Context) { // No need to update the view since the content is static } } struct ContentView_Previews: PreviewProvider { static var previews: some View { ContentView() } } any reason for this ? otherwise the program is running correctly, but is this a bug or a programming problem?
1
0
101
5d
Getting a crash in Webkit on iOS 18. Any solutions for this?
Here are the crash logs from Firebase Crashlytics Crashed: com.apple.IPC.ReceiveQueue 0 libsystem_platform.dylib 0x70c8 _os_unfair_lock_recursive_abort + 36 1 libsystem_platform.dylib 0x42d8 _os_unfair_lock_lock_slow + 308 2 WebKit 0xe2a5f0 <redacted> + 44 3 WebKit 0xe2a264 <redacted> + 320 4 WebKit 0xe29b24 <redacted> + 304 5 WebKit 0x1d8fc <redacted> + 740 6 libdispatch.dylib 0x40d0 _dispatch_client_callout + 20 7 libdispatch.dylib 0x7580 _dispatch_continuation_pop + 596 8 libdispatch.dylib 0x1b53c _dispatch_source_latch_and_call + 420 9 libdispatch.dylib 0x1a104 _dispatch_source_invoke + 836 10 libdispatch.dylib 0xb560 _dispatch_lane_serial_drain + 368 11 libdispatch.dylib 0xc1e0 _dispatch_lane_invoke + 380 12 libdispatch.dylib 0x17258 _dispatch_root_queue_drain_deferred_wlh + 288 13 libdispatch.dylib 0x16aa4 _dispatch_workloop_worker_thread + 540 14 libsystem_pthread.dylib 0x4c7c _pthread_wqthread + 288 15 libsystem_pthread.dylib 0x1488 start_wqthread + 8
1
0
103
5d
XPCConnectionTerminationWatchdog Crash
I recently update my ionic app to ionic angular 7. I'm having this crash that does not happen in the same way, neither in the same place. Aside from needed some entitlements that I've already requested the app is crashing all the time. This is the error. ⚡️ TO JS {"value":"en"} 2024-09-24 15:43:56.097126+0200 App[33392:5520337] [Process] 0x10d003260 - [PID=33408] WebProcessProxy::didClose: (web process 0 crash) 2024-09-24 15:43:56.097185+0200 App[33392:5520337] [Process] 0x10d003260 - [PID=33408] WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash 2024-09-24 15:43:56.097270+0200 App[33392:5520337] [ProcessSuspension] 0x10c020720 - ProcessAssertion: Failed to acquire RBS Background assertion 'XPCConnectionTerminationWatchdog' for process because PID 0 is invalid 2024-09-24 15:43:56.097368+0200 App[33392:5521826] [ProcessSuspension] 0x10c020720 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=0, error: (null) 2024-09-24 15:43:56.098184+0200 App[33392:5520337] [Process] 0x142832618 - [pageProxyID=8, webPageID=9, PID=33408] WebPageProxy::processDidTerminate: (pid 33408), reason=Crash 2024-09-24 15:43:56.101821+0200 App[33392:5520337] [Loading] 0x142832618 - [pageProxyID=8, webPageID=9, PID=33408] WebPageProxy::dispatchProcessDidTerminate: reason=Crash 2024-09-24 15:43:56.117084+0200 App[33392:5522124] [com.apple.VisionKit.processing] Error processing request from MAD on result: Error Domain=NSOSStatusErrorDomain Code=-128 "Request was canceled" UserInfo={NSLocalizedDescription=Request was canceled} request: <VKCImageAnalyzerRequest: 0x2830d0690> requestID: 6 madRequestID: 6 cancelled: YES 2024-09-24 15:43:56.245502+0200 App[33392:5520337] [Process] 0x10c07c380 - GPUProcessProxy::gpuProcessExited: reason=IdleExit 2024-09-24 15:43:56.245552+0200 App[33392:5520337] [Process] 0x10d002ce0 - [PID=33412] WebProcessProxy::gpuProcessExited: reason=IdleExit 2024-09-24 15:43:57.682680+0200 App[33392:5520337] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service 2024-09-24 15:44:04.249892+0200 App[33392:5520337] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service 2024-09-24 15:44:12.223579+0200 App[33392:5520337] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service 2024-09-24 15:44:26.098426+0200 App[33392:5520337] Could not signal service com.apple.WebKit.WebContent: 113: Could not find specified service 2024-09-24 15:44:59.812245+0200 App[33392:5522961] [MADService] Client XPC connection invalidated
1
0
88
6d
SFSafariViewController not loading web pages on Xcode 16 Simulator with iOS 18
After updating Xcode to the latest version we observed that SFSafariViewController is not loading web pages on Xcode 16 Simulator with iOS 18, whenever it is presented the View Controller is empty (does not load any content) and the app freezes, but other screens that use WKWebView are working normally. Also, during tests on physical devices with iOS 18 it seems to work just fine, so it might be just a IDE version problem. Is anyone experiencing the same issue? If so, did anyone find a solution for it?
7
6
386
6d
WKWebView can not play audio with webrtc on iOS 18 and iPadOS 18
I am experiencing an issue with my app, which includes a WKWebView used for displaying and playing WebRTC content (audio and video). Everything works fine on macOS, but on iOS 18, while the video is displayed correctly, there is no sound. I am wondering if this could be related to privacy permissions on iOS. Could you please clarify if there are any specific privacy permissions I need to address? I would like to confirm: AVAudioSession.sharedInstance().setCategory requires any special configuration for WebRTC audio. Are there any particular settings needed for this? My setting codes are below: try AVAudioSession.sharedInstance().setCategory(.playback, mode: .default, policy: .longFormAudio) Do the JavaScript codes in the HTML file require any special handling to ensure WebRTC audio works properly on iOS? const audioRender = document.createElement('audio'); audioRender.id = 'xxxid'; audioRender.srcObject = streamSource; audioRender.autoplay = true; audioHolder.appendChild(audioRender); Does WKWebViewConfiguration need any specific parameter adjustments to ensure audio playback in WebRTC works as expected? let webViewConfiguration = WKWebViewConfiguration() let contentController = WKUserContentController() contentController.add(self, name: "***") webViewConfiguration.userContentController = contentController webViewConfiguration.allowsInlineMediaPlayback = true
0
0
134
1w
Compatibility Issue with WebKit.WKWebView.evaluateJavaScript(_:completionHandler:) in Xcode 16
I've encountered an issue after upgrading to Xcode 16. I have an overridden func of WebKit.WKWebView.evaluateJavaScript(_:completionHandler:), which no longer compiles in the new Xcode. I noticed that in Xcode 16, the completionHandler now has @MainActor and @Sendable annotations, which causes a compilation error. public override func evaluateJavaScript(_ javaScriptString: String, completionHandler: (@MainActor @Sendable (Any?, (any Error)?) -> Void)? = nil) When I add these annotations to my overridden method, it compiles fine in Xcode 16. However, this breaks compilation in older versions of Xcode. The documentation for this API doesn't explicitly mention any changes, but the behavior is clearly different between versions. https://developer.apple.com/documentation/webkit/wkwebview/1415017-evaluatejavascript Xcode 15: Xcode 16: What would be the best way to handle this situation? Should I use a compilation condition to differentiate between the versions? If so, what would be the correct condition to check? Was there a Swift compiler update in Xcode 16 that could be affecting this? Or is it better to drop support for versions of Xcode earlier than 16? Or I should not override that? Thanks in advance for any insights!
4
1
211
15h
WKWebView on iOS 18: Video Auto-Play Not Working Inline, Launching in Full-Screen Instead
Hello, I'm experiencing an issue with WKWebView in my iOS app when running on devices with iOS 18. Specifically, when auto-playing videos, they do not play inline as expected but instead switch to full-screen mode. This problem only occurs on iOS 18; in earlier versions, the videos played inline without any issues. Here is the configuration I'm using for WKWebView: let configuration: WKWebViewConfiguration = WKWebViewConfiguration.init() configuration.allowsInlineMediaPlayback = true configuration.mediaTypesRequiringUserActionForPlayback = [] Additionally, I have set the playsinline attribute in the video tag on the web page. Despite these settings, when the webpage initially loads, the video sometimes plays in full-screen mode rather than inline. I am looking for a solution to ensure that videos always play inline as intended on iOS 18. Has anyone encountered a similar issue or know of any workarounds? Any help would be greatly appreciated! Thank you!
1
1
175
1w
WKWebView on iOS 18: Video Auto-Play Not Working Inline, Launching in Full-Screen Instead
Hello, I'm experiencing an issue with WKWebView in my iOS app when running on devices with iOS 18. Specifically, when auto-playing videos, they do not play inline as expected but instead switch to full-screen mode. This problem only occurs on iOS 18; in earlier versions, the videos played inline without any issues. Here is the configuration I'm using for WKWebView: let configuration: WKWebViewConfiguration = WKWebViewConfiguration.init() configuration.allowsInlineMediaPlayback = true configuration.mediaTypesRequiringUserActionForPlayback = [] Additionally, I have set the 'playsinline' attribute in the video tag on the web page. Despite these settings, when the webpage initially loads, the video sometimes plays in full-screen mode rather than inline. I am looking for a solution to ensure that videos always play inline as intended on iOS 18. Has anyone encountered a similar issue or know of any workarounds? Any help would be greatly appreciated! Thank you!
0
0
198
1w
WebKit binary compatibility broken in iOS 18
The non-async signature for WKNavigationDelegate's decidePolicyForNavigationAction has changed between iOS 17 and 18. In 17 it is func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping (WKNavigationActionPolicy) -> Void) In 18 it adds the MainActor attribute to the decision handler func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction, decisionHandler: @escaping @MainActor (WKNavigationActionPolicy) -> Void) We deliver xcframeworks to our customers with objects that implement this function, and when those customers upgraded to Xcode 16.0 / iOS 18, those frameworks broke despite ABI stability (since that's unrelated to the WebKit SDK's public signatures). I presume this is because the WebKit dependency in the iOS 18 SDK does not match the signature used those older frameworks (and the IDE errors seem to support this). We will of course deliver new frameworks targeting the new SDK, but that takes regression testing and release planning. In the meantime, this has been exacerbated by the fact that macOS Sequoia does not support Xcode 15. Those of our customers whose machines updated to Sequoia cannot build their projects at all until we're able to deliver frameworks that are compatible. Was this an expected change? I didn't see any deprecation warnings in iOS 17, and unless we're supposed to bundle WebKit within the framework somehow, I'm not sure how we could have done this without forcing the Xcode versioning on our customers. Is there a way we package this differently or some other solution to make our existing frameworks compatible with iOS 18 without having to target that SDK?
3
0
229
5d
run Http in webview local
hi, i have this problem. i need to use a webview to charge a file locally, to be more specific a file SCORM, like a mini web project. so i was making tests and the way to see all te content is in a http server. i mean if i click in the index.html of the file in my computer the page doesn't charge all the content, so i opened visual studio code and running Live Server thats provide me a project in http, well with that the project works. in android i'm make the example with something called WebViewAssetLoader, with that i can setup asset loader to handle local asset paths and override a WebView client, and if request is to local file, intercept and serve local. i want to know if in swift i have a way to intecept it a serve local this is one of the a lot of ways that i was tried and this is the example that works for me in android
2
0
189
1w
App not releasing memory immediately
We as a team of engineers work on an app intended to visualize medical images. The type of situations where the app is used involves time critical decision making for acute clinical conditions. Stability of the app and performance are of almost importance and can directly help timely treatment action. The app we are developing uses Javascript. It has been observed the footprint of the app is lagging by 2 to 3 seconds in releasing memory while javascript is expecting the memory to be cleared. This is affecting the stability of our application and preventing us in delivering the right quality of application. The problem specifically can be described as follows, using javascript create an array and then remove it and after removal of the array, create a new array of the same size immediately and again remove it. Because the memory is not released in time, if you repeat these steps a few times the app memory footprint will increase and that crashes the app. To reproduce this scenario, we have created a simple app which creates an array with size of 100MB and checks the memory footprint using the Xcode instrument tool. When we create an array of 100MB size, sometimes it shows the memory footprint peak of around 700MB-800MB and when we clear the array by assigning it with an empty array it releases the memory after 2-3 seconds. Considering the critical nature of the app, I urge you to look into this and provide necessary support and resolution. Please refer below sample code that will help to reproduce the mentioned scenario. import UIKit import WebKit class ViewController: UIViewController, WKUIDelegate { @IBOutlet var webView: WKWebView! let myHTML = """ <!DOCTYPE html> <html> <head> <style> .button-style { width: 400px; height: 200px; margin: 15px; font-size: 50px; } </style> </head> <body> <button type="button" class="button-style" onclick="loadDataInCache()">Load Data In Cache</button> <button type="button" class="button-style" onclick="removeDataFromCache()">Clear Cache</button> <script> const size = 1024 * 1024 * 100; let numberArray = []; function loadDataInCache() { numberArray = Array(size).fill(0); } function removeDataFromCache() { numberArray = []; } </script> </body> </html> """ override func viewDidLoad() { super.viewDidLoad() // self.view.addSubview(webView) webView.loadHTMLString(myHTML, baseURL: nil) } override func loadView() { let webConfiguration = WKWebViewConfiguration() webView = WKWebView(frame: .zero, configuration: webConfiguration) webView.uiDelegate = self view = webView } }
2
0
167
1d