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

Posts under WebKit tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

[bug report] Unicode characters with "variation selectors" are not rendered in the iPhone Safari browser (webkit) with iOS 17.3
Environment: iPhone 14/15, iOS 17.3 Description: Unicode characters with "Variation Selectors Supplement" code can be rendered correctly in all iPhone before iOS 17.3 . But in iOS 17.3, these characters become "blank" in iPhone. Fonts with Variation Selectors are used for displaying alternative Chinese characters reprensenting different pronoucation and different stroke styles. Screen capture from an issue case in iOS 17.3 (bad): Screen capture from a good case in other OS (good): Reproduce steps: Download a "Variation Selectors" supported TTF font https://github.com/ButTaiwan/bpmfvs/releases/download/v1.400/BpmfZihiKaiStd.zip Unzip the ttf font file "BpmfZihiKaiStd-Regular.ttf" from the zip to a folder In the same folder, create an file "index.html" with the following content: <head> <meta charset="utf-8"> <style> @font-face { font-family: zihaibpmf; src: url('BpmfZihiKaiStd-Regular.ttf'); } </style> </head> <body> <table class="redboder" border> <tr><td> Unicode Text </td><td style="font-family:zihaibpmf;">一</td><td style="font-family:zihaibpmf;">一󠇡</td><td style="font-family:zihaibpmf;">一󠇢 </td></tr><tr><td> Unicode Hex Code</td><td> 0x4E00</td><td>0x4E00 0xE01E1</td><td>0x4E00 0xE01E2 </td></tr> </table> </body> Upload the files to a web server Browser the "index.html" with an iOS 17.3 iPhone 14 or 15 There should be a character displayed in each table cells. But with iOS 17.3, two of the cells are blank. Reference: opensource IVS TTF font github: "BpmfZihiKaiStd" TTF Font file download : https://github.com/ButTaiwan/bpmfvs/releases/download/v1.400/BpmfZihiKaiStd.zip "Variation Selectors Supplement" is supported by all other OS (Windows, Android, Linux, old iOS, macOS), see : wiki : Variation Selectors Supplement https://en.wikipedia.org/wiki/Variation_Selectors_Supplement wiki : Variant form (Unicode) https://en.wikipedia.org/wiki/Variant_form_(Unicode) ...Variation Selectors Supplement is a Unicode block containing additional variation selectors beyond those found in the Variation Selectors block. These combining characters are named variation selector-17 (for U+E0100) through to variation selector-256 (U+E01EF), abbreviated VS17 – VS256.
4
1
685
Feb ’24
Error after GetProduct IAP on my app
I'm finding some issues with my iOS application that are related to the WebKit framework. I'm receiving the following errors in the application log: 01:05.995.258 Error Space Warhog (2434) com.apple.WebKit IPC 0x114088220 - Connection::dispatchIncomingMessages: IPC throttling was triggered (has 2'458 pending incoming messages, will only process 60 before yielding) 01:05.995.286 Error Space Warhog (2434) com.apple.WebKit IPC 0x114088220 - Connection::dispatchIncomingMessages: first IPC message in queue is WebUserContentControllerProxy_DidPostMessage It happens just when I make a purchase in the app. It does the whole process correctly (apparently), but once the "Purchase successful" pop up appears, the result is duplicated. If I make a second purchase, once I get the correct coins, the APP freezes and I have to restart it. Thank you for your help!
0
0
444
Feb ’24
MacOS App crashes when mouse moves over WKWebView, only under Ventura and Sonoma
This is a problem that only exists on MacOS 13 (Ventura) and MacOS 14 (Sonoma). On all earlier versions of MacOS, the existing code works well, and has for many years. I am working on an long-running Objective-C MacOS app (non-sandboxed) that uses WKWebView to display a static web page within a "pane" of a larger NSView. By "pane", I mean the WKWebView might be the only view within the encompassing NSView (thereby occupying all of its space), or it might occupy only one rectangle within it, if the NSView is divided into arbitrary rectangles. (Whether or not the WKWebView takes up the entire surrounding rectangle, or just a section of it, seems irrelevant.) The WKWebView is created offscreen at startup time, and later may become visible under user control. I don't need the displayed web page to permit any interactivity with the user other than scrolling, and I disable Javascript on the page using the WKWebViewConfiguration - which appears to work as intended. I therefore have no need for NSTrackingArea either, and am not using it. It does appear that the WKWebView has one NSTrackingArea by default, but it's not mine. I can remove it programmatically, but that does not appear to make any difference. When the WKWebView is visible, the app will instantly crash as soon as the cursor enters its rectangle. The stack trace shows the error: [_NSTrackingAreaCGViewHelper cursorAreas]: unrecognized selector sent to instance The problem here is that the _NSTrackingAreaCGViewHelper method appears to be something within an Apple internal framework - I can't find discussion of it anywhere on the Internet, or in Apple's developer docs. Same for the selector "cursorAreas" - I can't find any information about it at all. So this is starting to feel like a bug somewhere in Apple's internal framework. I can't understand why it's crashing with a message related to NSTrackingArea (or similar objects), when I'm not using tracking at all, but the "unrecognized selector" error is even more disturbing - I'm not calling the method, and certainly can't control the selector. I can't be sure, but this feels like Apple's error. I'd like to know if there might be a way for me to configure WKWebView to not use tracking at all, thereby eliminating the issue entirely, but I can't find a way to do that other than removing the NSTrackingAreas from the WKWebView, but that's not helping either. Can anyone (especially from Apple) offer any guidance? If it's an Apple bug, I would love to know how to work around it - it's a show-stopper for this app. Thanks in advance...
0
0
390
Feb ’24
iOS intermittently fails to send URLs via UISceneDelegate
I'm observing a sporadic bug in our web client where incoming URLs (triggered by a Push Notification or link tapped in another app) do not trigger either of the two expected API callbacks noted in the developer documentation for UISceneDelegate. Specifically, Apple's docs say: If your app has opted into Scenes, and your app isn’t running, the system delivers the URL to the scene(_:willConnectTo:options:) delegate method after launch, and to scene(_:openURLContexts:) when your app opens a URL while running or suspended in memory. Our client app has opted into scenes and the two callbacks mentioned above work reliably most of the time for incoming URLs. However, using the exact same test links or push notifications, I'm able to reproduce intermittent issues where I can see that neither of the above callbacks are triggered when the app is foregrounded to handle a URL. The bug seems to occur when: The app has been previously launched, and is backgrounded It's left in the background for some time (system memory pressure, from using other apps etc., might possibly play a factor also) In this scenario, sometimes when either an external link or URL via push notification is opened, I can see that neither of the two iOS delegate methods for UISceneDelegate are called. Our app is brought to the foreground correctly as though the URL will be handled, but the URL/link is not processed since it is never sent to our client. A few other notes: When the bug is repro'd using push notifications, I can see that our app receives a callback to userNotificationCenter:didReceive:, so the push notification definitely arrives. However, as noted above, the normal 2 API callbacks for UISceneDelegate are never triggered, and since those two callsites are where we handle incoming URLs, the URL from the push notification is never opened I haven't been able to observe any code in our app that precedes these hooks in our scene delegate that could be interfering. (As mentioned above, the same steps to replicate work the majority of the time) Does anyone know whether this could be a possible iOS bug? Any help/suggestions are greatly appreciated. Thank you
0
0
406
Feb ’24
watchOS 10 develop beta just broke his webview.
watchOS 10.4 Beta2 (21T5196d) broke its browser component! You can send youtube.com to your Apple Watch via iMessage, and then open it! Everything worked fine in the official version of watchOS 10.3; you couldn't watch videos because the Apple Watch's WebView doesn't have a video component, but you could at least browse web pages normally. However, in watchOS 10.4, WebView is completely broken, and you can't even view the homepage recommendations or try searching for content properly — web pages refresh automatically within seconds and keep crashing repeatedly. Please revert everything back to the state of watchOS 10.3! The minimal demonstration link to reproduce this bug: https://ling-bucket.oss-cn-beijing.aliyuncs.com/apple/minimalVideo.MOV
3
4
583
Feb ’24
Have you ever seen an issue like this in ios 16.0.2 wkwebview?
[ProcessSwapping] 0x12c002b70 - [pageProxyID=19, webPageID=35, PID=772, navigationID=6] ProvisionalPageProxy::didFailProvisionalLoadForFrame: frameID=3 2024-02-07 11:31:57.548906+0900 [763:23170] [Process] 0x10d117018 - [pageProxyID=19, webPageID=20, PID=769] WebPageProxy::didFailProvisionalLoadForFrame: frameID=3, isMainFrame=1, domain=, code=0, isMainFrame=1 2024-02-07 11:31:57.553241+0900 [763:23933] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit}> 2024-02-07 11:31:57.553341+0900 [763:23933] [ProcessSuspension] 0x12b01c2a0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'ConnectionTerminationWatchdog' for process with PID=772, error: Error Domain=RBSServiceErrorDomain Code=1 "target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit" UserInfo={NSLocalizedFailureReason=target is not running or doesn't have entitlement com.apple.runningboard.assertions.webkit} 2024-02-07 11:31:57.554500+0900 [763:24086] [assertion] Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}> 2024-02-07 11:31:57.554574+0900 [763:24086] [ProcessSuspension] 0x12b01c3c0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess Background Assertion' for process with PID=772, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist} I got an error like this, but it's only happening in iOS 16.0.2 and it's working fine in iOS 16.6 and later versions. I've never seen an error before, so I don't know how to solve it. The background fetch is turned on in the background mode of the capabilities. If you have any experience troubleshooting the above issue, please help me.
0
0
660
Feb ’24
WKWebView: SVG with 100% height and width is rendered truncated
If you render an SVG in the WKWebView component that has an <image> tag, xlink:href attribute and 100% height and width, the lower part of the SVG is always cut off. My expectation would have been that the SVG would be rendered entirety. This happens on all devices I have tested it on and in the simulator. It also happens regardless of the SVG file. It does not happen on Android devices or in other browsers. Minimal code example to reproduce: import UIKit import WebKit class ViewController: UIViewController, WKUIDelegate { override func viewDidLoad() { super.viewDidLoad() let webView: WebViewController = WebViewController() webView.loadView() view.addSubview(webView.webView) webView.setAnchors(view: self.view) } } class WebViewController: UIViewController, WKUIDelegate { var webView: WKWebView! func setAnchors(view: UIView) { webView.leftAnchor.constraint(equalTo: view.leftAnchor).isActive = true webView.topAnchor.constraint(equalTo: view.topAnchor).isActive = true webView.heightAnchor.constraint(equalToConstant: 160).isActive = true webView.widthAnchor.constraint(equalTo: view.widthAnchor, multiplier: 1.0).isActive = true } override func loadView() { let webConfiguration = WKWebViewConfiguration() webView = WKWebView(frame: .zero, configuration: webConfiguration) webView.uiDelegate = self webView.translatesAutoresizingMaskIntoConstraints = false view = webView webView.loadHTMLString(""" <svg width="100%" height="100%"> <image xlink:href="https://upload.wikimedia.org/wikipedia/en/5/56/Batman_Logo.svg" width="100%" height="100%"/> </svg> '''; """, baseURL: nil); } } Xcode version: 15.2 (15C500b) Bug reporting feedback reference id: FB13589238
1
0
462
Feb ’24
How to handle website requesting fullscreen in visionOS?
I am working on a native visionOS app. I'm running into a problem when websites request fullscreen. Sample code: import SwiftUI import WebKit struct WebViewWrapper: UIViewRepresentable { let url: String func makeUIView(context: Context) -> WKWebView { let webConfiguration = WKWebViewConfiguration() webConfiguration.allowsInlineMediaPlayback = false webConfiguration.mediaPlaybackRequiresUserAction = false let webView = WKWebView(frame: .zero, configuration: webConfiguration) webView.navigationDelegate = context.coordinator webView.uiDelegate = context.coordinator return webView } func updateUIView(_ uiView: WKWebView, context: Context) { if let url = URL(string: url) { let request = URLRequest(url: url) uiView.load(request) } } func makeCoordinator() -> Coordinator { Coordinator(self) } class Coordinator: NSObject, WKNavigationDelegate, WKUIDelegate { var parent: WebViewWrapper init(_ parent: WebViewWrapper) { self.parent = parent } func webView(_ webView: WKWebView, createWebViewWith configuration: WKWebViewConfiguration, for navigationAction: WKNavigationAction, windowFeatures: WKWindowFeatures) -> WKWebView? { if navigationAction.targetFrame == nil { webView.load(navigationAction.request) } return nil } } } struct ContentView: View { var body: some View { GeometryReader { geo in VStack { WebViewWrapper(url: "https://youtube.com") .clipShape(RoundedRectangle(cornerSize: CGSize(width: geo.size.width/40, height: geo.size.height/40))) .padding() } } } } #Preview(windowStyle: .automatic) { ContentView() } The error I'm getting: -[AVPlayerViewController enterFullScreenAnimated:completionHandler:] failed with error Invalid call of -[AVPlayerViewController (0x153087600) _transitionToFullScreenAnimated:interactive:completionHandler:]! Any help would be greatly appreciated.
4
0
622
Mar ’24
WKWebView sometimes lose cookies after the app returns from suspension
I embedded a WKWebView in my SwiftUI app, and loaded a list of HTTPCookie into a WKWebViewConfiguration object: var wkWebViewConfiguration = WKWebViewConfiguration() let cookies: [HTTPCookie] = ... // logic that creates a list of HTTPCookie for cookie in cookies { wkWebViewConfiguration.websiteDataStore.httpCookieStore.setCookie(cookie) } This logic works but when the app returns to the foreground from a long suspension (more than an hour), sometimes the web view reloads the URL but the cookies are gone. I suspect the web content process is terminated and add a logic to reload the URL and the cookies on process termination: // WKNavigationDelegate method func webViewWebContentProcessDidTerminate(_ webView: WKWebView) { // reload the URL and cookies here } but the issue still persist, could there be any other reasons that the cookies are lost or is my above solution not sufficient to handle web content process termination? This issue is quite random to me and there is no deterministic way to reproduce it.
5
1
1.5k
Feb ’24
WKWebView cannot load non-app-bound domains
WKWebView question...I've set up WKAppBoundDomains and am using limitsNavigationsToAppBoundDomains to enable evaluateJavaScript, Service Workers, etc. That's all working great. However, I'm no longer to able to load a WKWebView with any domain that is not one of the app-bound domains. For these other webviews, I don't need any of the special restricted APIs. I just want them to load and do basic website stuff. My impression from the docs is that this should be fine. Does it require explicitly setting config.limitsNavigationsToAppBoundDomains = false? Unfortunately I can't do that in all cases; some of the WKWebViews are created by external libraries where I can't edit the WKWebViewConfiguration Is there another step I need to take? Or, maybe something with a ContentWorld?
1
0
978
Feb ’24
Facing loader issue in IOS version 16.3.1
We are facing an issue in IOS version 16.3.1 where the animation based loader is not getting visible, but .svg based loader is working fine and the same animation based loader is working fine in android and windows, and all the remaining versions of IOS as well The html code : <div class="showbox overlayhideclass" id="overlayhideapple" style="display:none;opacity:2.9;"> <div class="loader"> <svg class="circular darkLoader" style="display:none;" viewBox="25 25 50 50"> <!-- Background ring --> <circle class="background-ring" cx="50" cy="50" r="22"></circle> <!-- Loading circle --> <circle class="path" cx="50" cy="50" r="22" fill="none" stroke-width="6" stroke-miterlimit="10"></circle> </svg> <svg class="circular lightLoader" style="" viewBox="25 25 50 50"> <!-- Background ring --> <circle class="background-ring" cx="50" cy="50" r="22"></circle> <!-- Loading circle --> <circle class="path" cx="50" cy="50" r="22" fill="none" stroke-width="6" stroke-miterlimit="10"></circle> </svg> </div> </div> classes: .loader { position: relative; margin: 0 auto; width: 100px; &:before { content: ""; display: block; padding-top: 100%; } } .circular { animation: rotate 1s linear infinite; height: 100%; transform-origin: center center; width: 74.84%; position: absolute; top: 0; bottom: 0; left: 0; right: 0; margin: auto; border-radius: 50%; } .background-ring { fill: none; stroke: rgb(227, 226, 231); stroke-width: 6; } .path { stroke-dasharray: 1, 200; stroke-dashoffset: 0; animation: dash 1.5s ease-in-out infinite, color 6s ease-in-out infinite; stroke-linecap: round; } @keyframes rotate { 100% { transform: rotate(360deg); -webkit-transform: rotate(360deg); } } @keyframes dash { 0% { stroke-dasharray: 100, 200; stroke-dashoffset: -100px; } 30% { stroke-dasharray: 100, 200; stroke-dashoffset: -100px; } 100% { stroke-dasharray: 100, 200; stroke-dashoffset: -100px; } } @keyframes color { 100%, 0% { stroke:var(--loader-icon); } 40% { stroke:var(--loader-icon); } 66% { stroke:var(--loader-icon); } 80%, 90% { stroke:var(--loader-icon); } } body { background-color: var(--white); } .showbox { position: absolute; top: 0; bottom: 0; left: 0; right: 0; width: 100vw; height: 100vh; display: flex; align-items: center; } .overlayhideclass { position: fixed; width: 100%; height: 100%; top: 0; left: 0; text-align: center; opacity: 2.9; background-color: Var(--pg-bg-primary); z-index: 9999; display: flex; justify-content: center; justify-items: center; justify-self: center; overflow:-y:hidden; } .darkLoader { z-index: 100; display: flex; justify-content: center; align-items: center; } .lightLoader{ z-index: 100; display: flex; justify-content: center; align-items: center; }
1
0
410
Feb ’24
Using WKWebKit and Safari on visionOS
I have implemented a custom view that shows a page in WKWebKit: import SwiftUI import WebKit struct WebView: UIViewRepresentable { let urlString: String func makeUIView(context: Context) -> WKWebView { let webView = WKWebView() webView.navigationDelegate = context.coordinator return webView } func updateUIView(_ uiView: WKWebView, context: Context) { if let url = URL(string: urlString) { let request = URLRequest(url: url) uiView.load(request) } } func makeCoordinator() -> Coordinator { Coordinator(self) } class Coordinator: NSObject, WKNavigationDelegate { var parent: WebView init(_ parent: WebView) { self.parent = parent } } } It works, but it shows a grey button in the upper left with no icon. If I click on that button, nothing happens. But I can see this error message in the Xcode logs: Trying to convert coordinates between views that are in different UIWindows, which isn't supported. Use convertPoint:fromCoordinateSpace: instead. What is this button, and how can I get rid of it? As a second question: I also tried to spawn Safari in a separate window, using this view: import SafariServices import SwiftUI struct SafariView: UIViewControllerRepresentable { let url: URL func makeUIViewController(context: Context) -> SFSafariViewController { return SFSafariViewController(url: url) } func updateUIViewController(_ uiViewController: SFSafariViewController, context: Context) { // No update logic needed for a simple web view } } This works, but Safari shows up behind the view that is including the Safari view. Instead, I would want Safari to show up in front - or even better: next to my main view (either left or right). Is there a way to do this?
2
0
672
Feb ’24
Hangs with non-busy main thread using Instruments
Hi! I watched the 'Analyze hangs with Instruments' video from WWDC2023. It's such a great video! Unfortunately, I found a case that the video doesn't cover when profiling my browser app using Instruments: As shown in the image, the hangs still occur even though my main thread is not busy, and I've also used the 'Thread State Trace instrument' to confirm that the main thread is not blocked either. I'm not sure what the next step is to resolve the hangs. Any insight or guidance would be much appreciated. Thank you!"
3
0
562
Feb ’24
run Javascrip on Safari
Hello, I am experiencing an issue when running a script on Safari, specifically WebKit. Here is a sample HTML code: <!DOCTYPE html> <html lang="en"> <head> <script> function delayedFocus(e) { e.preventDefault(); setTimeout(function() { e.target.focus(); }, 1000); // Adjust the delay time as needed (in milliseconds) } </script> </head> <body> <ul> <li> <input type="text" id="testtext" onmousedown="delayedFocus(event)"> </li> </ul> </body> </html> The logic behind this script is to introduce a 1-second delay when the user clicks on the textbox. After 1 second, the keyboard should appear. Testing on Android mobile devices shows the expected behavior. However, on iPhones, the textbox receives focus, but the keyboard does not appear. This issue has been observed on various iOS versions, with the script working only on iOS 15. If you have any insights or solutions to address this compatibility issue, it would be greatly appreciated. Thank you.
0
0
485
Feb ’24
Embedded webview on app crashing
My Flutter app has a embedded webview I use to render LaTeX using mathjax. With the recent iOS 17 updates (I believe it started happening with iOS 17.2/17.3) the embedded webview started crashing. This is the only output I'm seeing in the logs: WebProcessProxy::didClose: (web process 0 crash) WebProcessProxy::processDidTerminateOrFailedToLaunch: reason=Crash ProcessAssertion: Failed to acquire RBS Background assertion 'XPCConnectionTerminationWatchdog' for process because PID 0 is invalid ProcessAssertion::acquireSync Failed to acquire RBS assertion 'XPCConnectionTerminationWatchdog' for process with PID=0, error: WebPageProxy::processDidTerminate: (pid ), reason=Crash WebPageProxy::dispatchProcessDidTerminate: reason=Crash GPUProcessProxy::didClose: GPUProcessProxy::gpuProcessExited: reason=Crash WebProcessProxy::gpuProcessExited: reason=Crash WebProcessProxy::gpuProcessExited: reason=Crash WebProcessProxy::gpuProcessExited: reason=Crash WebProcessProxy::gpuProcessExited: reason=Crash WebProcessProxy::gpuProcessExited: reason=Crash ProcessAssertion::remainingRunTimeInSeconds failed to get handle for process with PID= Error acquiring assertion: <Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}> ProcessAssertion::acquireSync Failed to acquire RBS assertion 'GPUProcess Background Assertion' for process with PID=695, error: Error Domain=RBSAssertionErrorDomain Code=2 "Specified target process does not exist" UserInfo={NSLocalizedFailureReason=Specified target process does not exist}
1
0
620
Feb ’24
Services Worker in WKWebView
Hi, we have a services worker configured in a web page to work offline. The page is loaded in the WKWebView component and we observe that the services worker is not registering correctly, is this component compatible with the API of the services worker? If so, how would be the correct implementation, if it is not compatible, what alternatives are there? thanks!
2
0
803
Feb ’24
How to specify identifiers for HTML elements for hybrid app?
I'm currently developing hybrid MacOS app that display some content in WebKit. I wanted to write some UI tests using Appium for it. For this I'm currently using Mac2 driver https://github.com/appium/appium-mac2-driver The problem that I faced is specifying identifiers for HTML elements to easily find them later in tests. It seems Appium uses Accessibility framework to get list of elements. Also it seems that accessibility framework parses HTML and wrap them to XCUIElements in XML Source (I can see this in Appium inspector, check the screenshot) As you can see Appium tries to get accessibility identifier/label from these elements. While searching in web I found, that if we specify aria-label="something" property on HTML element, it will be parsed by accessibility framework as label. So we can use labels for locating elements. However in ideal scenario we should have some HTML property that will be parsed to identifier, as accessibility label is used for accessibility needs, while identifier is allocated for UI testing. So my question is there HTML tag that can be used to specify identifier, and if not, is there plans to add support for it?
0
0
395
Jan ’24