Explore the integration of web technologies within your app. Discuss building web-based apps, leveraging Safari functionalities, and integrating with web services.

All subtopics

Post

Replies

Boosts

Views

Activity

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
859
Feb ’24
Strange counting in Safari
First: don’t tell me about webkit-reporting. I just get a 502 from there! Ok, what’s the problem? I made an example telling it all: <html> <head> <style> .ext { display: none; color: cyan; } body { max-inline-size: calc(100vi - 12px); &:not(:has(:target)), &:has(p.dft:target) { #ext { display: none; } #dft { display: block; } } &:has(p.ext:target) { #ext { display: block; } #dft { display: none; } } &.ext li { display: none; } &:has(.ext:target) { & li.ext { display: revert; } } } header > p > a::before { color: orange; content: "click me >>> "; } ul { display: flex; } li { margin: 1ex; list-style-type: none; inline-size: max-content; } .yes li::before { font-size: 70%; color: yellow; background-color: blue; content: "(" counters(total, ":") ")"; } ul.nGrp { display: inline flex; counter-reset: nameIndex; & li::after { display: inline-block; counter-increment: nameIndex; font-size: 75%; color: red; vertical-align: sub; content: "(" counter(nameIndex) ")"; } } header { inline-size: 100%; font-size: 2rem; text-align: center; } article { counter-reset: total; padding: 1ex; margin: 1em; &::after { font-size: 3em; color: purple; content: "— [" counter(total) "] —"; } li { counter-increment: total; } outline: 1ex groove purple; } </style> <title>Strange Safari-Count</title> </head> <body lang="de"> <header> <hgroup><h1>Strange counting without <code>:before</code></h1><p>different from FireFox!</p></hgroup> <p id="dft" class="dft"><a href="#ext">More?</a></p> <p id="ext" class="ext"><a href="#dft">Less!</a></p> <p><code>:before</code> doesn’t inherit parent’s display:none? (same in FireFox)</p> </header> <article> <ul> <li class="dft"><p>A1</p></li> <li><ul class="nGrp"><li class="dft"><p>A1</p></li><li class="dft"><p>A1</p></li></ul></li> <li class="dft"><p>A3</p></li><li class="dft"><p>A4</p></li> <li><ul class="nGrp"><li class="dft"><p>A5</p></li><li class="ext"><p>A5</p></li></ul> </li> <li><ul class="nGrp"><li class="dft"><p>A6</p></li><li class="dft"><p>A6</p></li><li class="dft"><p>A6</p></li></ul></li> </ul> <ul> <li><ul class="nGrp"><li class="ext"><p>B1</p></li><li class="dft"><p>B1</p></li></ul></li> <li class="dft"><p>B2</p></li> <li><ul class="nGrp"><li class="dft"><p>B3</p></li><li class="ext"><p>B3</p></li></ul></li> </ul> </article> <article class="yes"> <ul> <li class="dft"><p>A1</p></li> <li><ul class="nGrp"><li class="dft"><p>A1</p></li><li class="dft"><p>A1</p></li></ul></li> <li class="dft"><p>A3</p></li><li class="dft"><p>A4</p></li> <li><ul class="nGrp"><li class="dft"><p>A5</p></li><li class="ext"><p>A5</p></li></ul> </li> <li><ul class="nGrp"><li class="dft"><p>A6</p></li><li class="dft"><p>A6</p></li><li class="dft"><p>A6</p></li></ul></li> </ul> <ul> <li><ul class="nGrp"><li class="ext"><p>B1</p></li><li class="dft"><p>B1</p></li></ul></li> <li class="dft"><p>B2</p></li> <li><ul class="nGrp"><li class="dft"><p>B3</p></li><li class="ext"><p>B3</p></li></ul></li> </ul> </article> </body> </html> At least have an eye on the total count at the end of the (identical) articles! Before and after clicking the teaser.
4
0
897
Feb ’24
Website Video Element Volume cannot be controlled on non default audio devices
Dear Apple: I have a Website with a HTML Video Element. It is a Videochat. I want to change the speaker device but this currently does not work. I've fixed it locally via .setSinkId(sinkId) already (can be simulated via audioff addon) but ran into a major problem on macOS. The user that changes the desired speaker cannot change the volume via volume keys on macOS. Problem: So I can fully mute my macbook and the website keeps screaming at me! Reason: Just the default device gets muted which is not necessarily what the user selected as Output device for the html video/audio element via .setSinkId(sinkId). Steps to reproduce: Use Firefox (Safari doesn't even support HTMLMediaElement API: setSinkId) Install and activate the addon audioff (you can setSinkId on a different audio output device per website, similar to how I would fix the bug) You need a element that plays sound. I use a hallosophia.com account and created a meeting link and join twice. You can use this Link where anyone can join: https://www.hallosophia.com/waiting-room/724c6fb2-7261-4133-a3e6-66dfd4a0263f/inkognito - speaker doesn't apply so set it to MacBook but will not apply and still be in your AirPod. Have one AirPod in the ear and go to the website with the sound playing element and right click on the page to "Audio output select" via audioff (which you could also do as the website itself via .setSinkId(sinkId)) and change the speaker from AirPod to MacBook. -> As expected you will have the sound on your MacBook speakers but you cannot change the volume via Volume keys. Even if your MacBook is muted the website can "scream at you" I can verify that macOS has the default behaviour of changing just the default speaker volume by installing the non verified app MultiSoundChanger. With this app installed everything works as expected and it changes all audio devices volume at the same time. But it is not even a verified app. So I would say what needs to change is the default behaviour in macOS that it changes the volume of all speakers and not just the default speaker. And that Safari starts to support .setSinkId(sinkId). I use a MacBook Air 2020 on Sonoma 14.2.1 with Firefox 122.0
0
0
351
Feb ’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
2.5k
Feb ’24
Disable iOS 17 Facetime Reactions
Hello, is it somehow possible to disable the FaceTime Reactions by getUserMedia constraints (for example) by JavaScript code? I need just to force to disable this feature by JavaScript for my web tool. I am happy about any solution (even if it is done by HTML property). Greetings
0
0
499
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
826
Feb ’24
JavaScript Core Optimization on Mobile?
Years ago, JSCore on non-macOS disabled JIT, leading to much worse performance than could possibly be achieved with JIT on. Has anything changed recently to permit greater optimizations for JSCore on mobile platforms? (iPadOS, visionOS). My guess is ”no” since the docs still llist only macOS under the MAP_JIT flag, but as far as I know, Apple could still choose to enable JSCore optimizations behind the scenes if this option were available to developers.
4
0
1.1k
Feb ’24
SFSafariViewController Download UX - Divergent Behavior
I've been conducting tests on various iOS apps to identify those that disrupt website downloads when using in-app browsers. During my testing of Gmail, I observed that clicking on Safari within the app actually leads to what seems to be SFSafariViewController. However, the downloading experience within this view is notably cumbersome. To save an image, users must first select 'More...' then scroll to find and select 'Save image'. This behavior is unexpected when users anticipate accessing the full Safari browser. What are the reasons behind the differing UI/UX of SFSafariViewController and Safari?
0
0
357
Feb ’24
Safari and Safari Technology Preview completely broken after upgrading from Ventura 13.6.5 to Sonoma‌ 14.4
Hi, three days ago I made the mistake of upgrading to Sonoma 14.4. After the upgrade, I tried to open Safari, and was met with a popup window/prompt asking whether I want to open the window/tabs from the previous session. Regardless of whichever option I chose, Safari just froze completely. I tried force quitting, and starting Safari whilst holding the Shift key (which should open a fresh session), but that also didn't work. Following that, I tried starting Safari in Safe Mode, but that also did not work. I should note that at this time Safari Technology Preview was working fine. After half a day of trying to troubleshoot this, an Apple Mail extension (Mailbutler) prompted me to sign in to my Google account, and that process triggered a small window/session of Safari to open (with the Gmail login page). Finally, I was able to access the Safari menubar settings. I went into the menubar settings, deactivated all 20 or so of my extensions, deleted all website data, deleted cache for both of my two profiles, quit Safari, and then tried to open Safari hoping all of that would have fixed it. This time, Safari just froze immediatly without giving me to option of restoring the previous session or not. I tried accessing the Safari menubar settings several times using the Apple Mail/Mailbutler/Gmail login loophole, and after some trial and error I discovered that I was able to open a window with my secondary profile ("Work"), without any problem. I also tried to open a window with my default profile ("Personal"), multiple times - but this always caused Safari to freeze/become unresponsive. At this point, I assumed that the default profile must have been "corrupt" in some way (I have no idea how that could even happen though). I've called Apple Support, and Apple Developer Support, 3-4 times in the last couple of days trying to get help, but as soon as they hear that I am on Sonoma Beta, they just give up and say that they have no obligation to assist customers with beta versions (despite having AppleCare), and the only recommendation they can give is to format the computer and do a complete Time Machine backup restore.. After having spoken to Apple Support, I've tried to reinstall Sonoma three time. I have tried to selectively, and completely, delete the Safari library files (and then restoring backups when noticing that it hasn't worked). I have also tried to use Cookie (by SweetP Productions) to delete various Safari files, hoping that might fix the issue. Finally, I've tried to delete all of the Safari library files (with backups), and then using Time Machine I've attempted to restore all the files that were used by Safari prior to the Sonoma upgrade (this also didn't work). Earlier today I decided to simply give up, and just forget about Safari. After all, Safari Technology Preview was working fine, and I could just use that until Apple pushes a new Sonoma update (which would hopefully repair Safari). But after half a day of using Safari Technology Preview, I now seem to have run into the exact same problem. Right now, both Safari and Safari Technology Preview are completely broken. Both programs become unresponsive the moment they are launched. As Apple provides the dmg file for Safari Technology Preview on their website, I figured I should at least be able to simply reinstall the app and that would solve the problem. But reinstalling Safari Technology Preview doesn't seem to do anything at all. Long story short - I have somehow managed to break both Safari and Safari Technology Preview after upgrading from Ventura 13.6.5 to Sonoma‌ 14.4. Apple are telling me they won't provide any help as I am using beta software. If anyone has any suggestions or ideas for how to solve this (for example, deleting any of the library/support files?), please don't hesitate to share. Thanks
0
1
504
Feb ’24
WebXR Microphone Input Issue
Hello, I'm developing a WebXR application in Safari on visionOS. This app uses the microphone input in WebXR. I've noticed that with the microphone permission allowed the audio input doesn't capture. The size of the blob is always 0. I made a small demo here: https://github.com/chrisdubya/avp-threejs-webxr-test I've tried this demo on other WebXR supported HMDs and the audio capture works fine.
0
1
582
Feb ’24
[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
956
Feb ’24
Having issues clearing cookies in Safari via NextJS
I have a web application built in NextJS that I use cookies to handle persisting authentication details. I clear the cookies on logout and this works in other browsers. However, when I run this on Safari, it seems the browser is caching the cookie information. When I use the Safari debugger, I do not see the cookies in the Storage view, however, when I use document.cookies, I can retrieve them fine - which should not happen. This is not the case in Chrome. I can't find any information on this online, so any help or insights would be greatly appreciated.
0
0
623
Feb ’24
Safari(>17) in Private mode strips GET query parameters from window.location
In Safari 17's private mode, an inconsistent behaviour has been observed where GET query parameters are stripped from window.location after following user's click on any link with GET query parameters. The issue is reproducible for any link with GET query parameters. This issue varies; in some cases, the parameters remain visible in the URL, while in others, they are removed. (The window.location is always stripped of the query parameters). This behaviour impacts both iOS and MacOS users, suggesting a broader issue with Safari's treatment of URL parameters in private mode. The issue is not reproducible on both Safari < 17 and Safari 17 in Normal mode. Most probably it is the result of adding Advanced Tracking and Fingerprinting Protection in Safari 17. Can you please clarify logic behind Advanced Tracking and Fingerprinting Protection? Is it an expected behaviour?
1
0
933
Feb ’24
Safari on macOS does not update the SDR/HDR information about the display on which it is displayed
I have noticed that Safari on macOS does not update the SDR/HDR information about the display on which it is displayed if you refresh the page. Specifically if I use this query and set my MacBook Pro monitor to XDR the result will be "HDR true", but if I then set the monitor to a non-HDR mode like "Photography P3" and refresh the page the result is still the same. The only way is to close the tab, open a new one and launch the query again. This behaviour does not happen with chrome for example, a simple page refresh is enough. The problem in common use can be found on YouTube with an HDR video. If the YouTube player page is already loaded and you change the monitor settings (from SDR to HDR or vice versa), you are forced to close and open a new browser window to have the player loaded with the correct video format. You can check this behavior directly on the site I developed for the HDR test wide-gamut.com It would definitely be more efficient if this information was updated simply by reloading the page.
1
0
410
Feb ’24