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

General Documentation

Post

Replies

Boosts

Views

Activity

WKWebView iOS: Double-tapping the space bar doesn't insert a period.
Even when iOS's '"." Shortcut' keyboard setting is enabled, double-tapping the spacebar in WKWebView doesn't insert a period. While making WKWebView editable , "." shortcut is not working. It works fine when any other external keyboard is used. I am facing this issue in WKWebView using apple keyboard. Even forceful adding javascript to replace double tap of space bar to period character logic is not working.
0
0
499
Mar ’24
Incorrect UserAgent in iPad OS safari
Hi I am using safari in iPad OS (17.4). when I am checking the user agent, It is showing like Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/17.4 Safari/605.1.15 there is no indication that it's from iPad. How would I detect iPad from user agent whereas on IPhone it can easily be detected. Could you please help me here?
0
0
608
Mar ’24
PDF Text recognition in WKWebView iOS 16 iOS 17
Problem: Hello! I have some problems with UIEditMenuInteraction in WKWebView which show PDF using PDFKit (as far as I know) - when text is selected, there is no copy/paste buttons on iOS 16.4 or higher. Also I've noticed that selection blue view take less space than actual text is on iOS 17. The problem both cyrillic and latin characters. How I can fix this? p.s. I found on stackoverflow that PDFKit can treat PDF files like images, but on view hierarchy there is no differences between 16 and 17 iOS How it looks: The problem file: https://drive.google.com/file/d/1Tu8RCrlwOI_H3TcwOGFbDR0G9h1OP7MU/view?usp=sharing
0
0
352
Mar ’24
I can't see a property on Safari after add an script on WKWebView
After insert this script I can't see the property window.app.isNative = true on Safari, What I'm missing here? Thanks in advance userContentController.addUserScript(WKUserScript(source: """function() { if (!window.app) { window.app = {}; } window.app.isAndroid = false; window.app.isIOS = true; window.app.isNative = true; originWhitelist={['*']} } """, injectionTime: .atDocumentStart, forMainFrameOnly: true))
0
0
322
Mar ’24
Cannot find duplicate root CA for development Safari claims to have
I use three Macs for development of a web application. On each of the Macs (macOS 14.4) I used mkcert to install a local CA and to issue developer certificates (all separately). Accessing the web app with https://localhost:8080 works fine on two Macs with all browsers, but on one Mac Safari claims to have another root CA for localhost which it does not trust. And I cannot override the trust settings. Using Keychain Access I do not find this certificate. Safari shows it like this: Scrolling down I can see DNS Names localhost, localhost.localdomain and lvl.me, so I suspect it is a leftover from trying to install a root CA before using mkcert. The mkcert certificate looks like this and I can see it in the System keychain: So Safari complains and I cannot tell it to trust the server certificate as the CA does not fit (I think). Firefox and Chrome open the website just fine after warning me and me telling them to do so. I tried to find the wrong CA using Keychain Access and Terminal (security find-certificate -a -c localhost, security find-certificate -a -c lvh...) but in vain. Where can I find this certificate and how can I delete it?
2
0
525
Mar ’24
I am Website admin, I have my website and it is not opening in iOS and working in android devices
I had my website perfectly opening before the iOS 15 update for iPhones. But after that whenever anyone is opening my website it shows blank screen. It is working fine MacBook safari, chrome and all other android devices. Here is the link to the website : [https://startstaging.web.app/PO/1709528483037) I have cleared history, cache, have done resetting the phone, still it hasn't done anything. I don't know how to make it work, do help.
0
0
174
Mar ’24
Iffy runningboard errors using WKWebView in macOS application
I'm migrating a macOS application from the old and deprecated WebView to the new and sparkly WKWebView. It seems to work fine, but four error messages appear in the console (see below) just after the dialog is closed. I searched. It seems this issue can be fixed through the addition of a target entitlement called Background Modes. This particular capability is however not listed by Xcode, so I can't add it. I think this is because we're targeting macOS and not iOS, but I'm not certain. Stuck. Tips and advice appreciated! 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}> 0x2c40246c0 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'WebProcess NearSuspended Assertion' for process with PID=66538, 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} 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}> 0x2c4024720 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'GPUProcess Background Assertion' for process with PID=66540, 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} Deployment target is 10.15, Xcode version is 15.3.
0
0
453
Mar ’24
WebGPU for IPAD
It is 2024. WebGPU has been available for Safari on desktops since December of last year, as well as other browsers for quite some time. It's about time it was made available on the IPAD; at the very least as an advanced feature. WebGPU provides many opportunities to create compelling experiences in other browsers on different device, but not in the Safari browser for IPAD users. I bought an IPAD a few years ago, but the lack of ability and sub-par software, is one of the reasons I can't justify buying another, and many students feel this way. I know so many that are still buying android and surface pros because we are being held back from both creating and consuming newly possible web experiences when we use IOS devices. There are quite a few other things we need, such as a proper set of dev tools, even just for the browser, but webGPU is a must in order to stay competitive. Students who bought IPADs for school and for development need to be allowed to keep up with those using other platforms. Machine Learning, Signal processing, image processing, anything could benefit from compute shaders and uniforms... massive number crunching capability is a must going forward in the web, and those with IPADs need to be allowed to take part. More capabilities will equal more sales.
2
0
1.2k
Mar ’24
Developer method to disable Safari Credentials Manager on forms
I'm revisiting code I developed a while back for managing data entry about users, which includes giving them a username and password in the form that an administrator uses. I thought I'd found a way previous to get Safari to NOT try to over-write a field called username with the administrator's username and to NOT store the password they'd entered / reset against their credentials stored in the administrator's keychain. It seems to still be working in other browsers, but for Safari, it's stubbornly popping up "save this password" and offering to autofill... it's driving me nuts. Is there a solution?
0
0
249
Mar ’24
WKWebView Crash
Xcode 15.3 build with device(iPhone 12 / iOS 17.4) var webView: WKWebView = { let view = WKWebView(frame: .zero, configuration: WKWebViewConfiguration()) return view }() Thread 1: EXC_BREAKPOINT (code=1, subcode=0x1a049fa48) Hello. Also in Firebase too. At first I thought it was a Firebase issue. https://github.com/firebase/firebase-ios-sdk/issues/12485 But there seems to be a problem with iOS 17.4. There is no problem when running the app after disconnecting. Thanks for attention.
0
0
614
Mar ’24
HTMLAudioElement issues in iOS 17.4
We have an angular/ionic based app that has an audio playback feature. It appears that iphone (but not ipad) users who upgrade to iOS 17.4 can no longer play audio in our app. iPad users who upgraded to 17.4 don't have an issue. We use the HTMLAudioElement for audio playback. It appears that in 17.4 it is no longer firing the 'canplay' event that we listening for, for starting our playback. The other data buffering events like 'loadeddata' are also not being delivered. By changing the logic to listen for the 'loadstart' event, audio playback works and then the remaining 'canplaythrough' and 'canplay' are delivered. In other words, I need to start playback before any data buffering status events are delivered, otherwise they never get delivered. I am testing this against an audio delivery server on my same machine and have confirmed that the data is correctly delivered. Is anyone else experiencing a similar issue on iphones in iOS 17.4?
4
1
1.4k
Mar ’24
Safari App Extension: JavaScript script is responding to phantom messages
My Safari App Extension is having trouble with one website. This is typical for some other websites as well. Navigating to that website results in 6 “Load” events. For each such event I send a “safari.extension.dispatchMessage” to my objC code. For the first of these Load messages, my objC code sends a ‘sendMeIcons” message to “safari.self.addEventListener('message', function(event)”. The other 5 Load events are ignored by my objC code and do not send this message. safari.self.addEventListener('message', function(event) receives sendMeIcons JUST once. Yet, the event handler for this message) is invoked 4 times. The first invocation is correct. The other 3 are spurious. I have no idea why this is happening. Here is my objC code safari.self.addEventListener('message', function(event) { if (event.name === "Load My URL") { console.log('In event listener Load My URL'); ... return; } if (event.name === "sendMeIcons") { ... if (hrefs.length <1) //THIS IS ALWAYS TRUE FOR THIS TEST CASE. { safari.extension.dispatchMessage("js Found No Icons"); return; } else { ... safari.extension.dispatchMessage("IconsReturned",{"urls": arrayOfUrls}); return; } } I don't have a clue how to proceed. Any suggestions.
1
0
452
Mar ’24
SFSafariViewController will sometimes ignore redirects to non-https URLs if no user interaction occurs
We have a payment process in an app which involves loading up a Web page to allow a user to enter credit card details, and to complete a transaction. This web page may result in a 3D-Secure step up challenge. For PCI compliance purposes we launch this in a SFSafariViewController. This 3D secure process involves a collection of redirects, with a final one back to us known as the "Merchant Page". In here, we want to do one more redirect, using a custom URL scheme, to allow the app to recognise that the process has completed, and can safely dismiss the SFSafariViewController. In those cases where no "step up 3d challenge" occurs, the process works well, the final redirect occurs, and our app successfully dismisses the SFSafariViewController. However, in a step up challenge, the Merchant Page loads, but any attempt to do the final custom redirect does not execute. I believe this is a feature of Safari - What I think is going on is that enough time has passed since there was user interaction on the page, and the final redirect, which isn't a https or http link (it is a myapp:// link) simply gets ignored. We've tried a lot of things. One thing works: If we provide a button, and when it is tapped, it sets window.location.href = 'myapp://success?', this works. This is a clue to if it is cause by lack of user interaction. We've tried lots of things: Rather than a javascript redirect, we tried server side redirecting; we tried all of the HTTP 300 response codes. They were all ignored We tried the meta refresh (which we know is kinda deprecated). We tried window.location.href = , window.location.assign(), document.location.href, document.location.assig(), etc. We tried issuing an Ajax XMLHttpRequest, but this failed because it isn't https or http We even tried to suggest our non-standard URL was the source of a script, just to trigger it but it didn't work. We've tried calling in during body onload We've tried calling it using a timeout in case timing was relevant. My gut feeling here is this is a feature. I've used Safari Debugging, and it literally steps over the window.location.href assignment, and doesn't produce a warning or an error. We've added try/catch, and no exception was thrown. Again, it leads me to believe this is all by design (perhaps to prevent ad fraud or something?). I was kinda hoping that in the response, we'd be able to specify a CORS header that tells the browser that "it will be ok to use resources from myapp://", but haven't found the right one. We may end up having to simply produce a button with a message "Your transaction has completed, please press here to dismiss", but it is terrible UX that is unnecessary. I've seen a number of posts elsewhere suggesting that redirects without user interaction can be considered suspicious, and I've experience of this same problem on another browser. If anyone has cracked this one, I'd love to know how
1
0
478
Mar ’24