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

How to change geolocation settings on WKWebView
We're developing an application using location feature in WKWebView. When accessing a URL that uses location information from WebView, a dialog box saying " Would Like To Use Your Current Location - Don't Allow or OK". If "Dont allow" is selected multiple times, the dialog will disappear and the location setting for that URL will be fixed as "Don't Allow". In Safari, I can change that location settings for each URL, But Application's WebView does not have such settings UI. How do I clear or change the setting so that location information is no longer available? It seems that reinstalling the application will clear the WebView location settings.
0
0
194
4w
Enabling Picture-in-Picture (PiP) in WKWebView
I'm working on a web browser App that's distributed via the App Store. This app renders web pages using WKWebView. Our users are requesting a way for us to allow them to play videos in Picture in Picture. After some investigation, we noticed that in order to allow PiP videos in our browser in the sandboxed environment, we need to add the com.apple.PIPAgent entitlement under the com.apple.security.temporary-exception.mach-lookup.global-name option. We tried to submit our app with this entitlement, but unfortunately, we were rejected: Guideline 2.4.50) - Performance We've determined that one or more temporary entitlement exceptions requested for this app are not appropriate and will not be granted: com.apple.security.temporary-exception.mach-lookup.global-name com.apple.P|PAgent We would like to have access to this entitlement so we can offer PiP to our users. We already created a radar about this as well: FB13814428 Additionally, we have another radar (FB13557716) regarding allowing the usage of a private flag _allowsPictureInPictureMediaPlayback, which would also be required to enable us to use PiP. Is there any way in which we can currently enable PiP? Would opening a TSI help here?
1
11
423
Jun ’24
WKWebKit crash - blank screen
We are using a WKWebKit based Cordova application and we are getting WKWebKit crash resulting in blank page. The same web app is working in browser and other platforms. Upon investigation we found the memory used in iOS app using safari debugger / profiler. The total memory used is 870.13 MB. Break up of that is Page: 549MB JavaScript: 321.13MB However, the max comparison for memory shown in safari is 1.37GB while the current usage is 870.13MB. Is there any internal memory calculation for crash cutoff? In this case the current memory is around 62% of the max comparison. Hence, we need to know whether this is the expected behaviour from iOS platform. JetsamEvent-2024-05-23-102822.ips
0
0
260
Jun ’24
SFSafariViewControllerDelegate not being called for redirects
This method does not seem to work consistently: SFSafariViewControllerDelegate.safariViewController(_ controller: SFSafariViewController, initialLoadDidRedirectTo URL: URL) It was working 100% of the time until this week for me, now it has about a 1-5% success rate for detecting redirects. The docs are not clear: @discussion This method may be called even after -safariViewController:didCompleteInitialLoad: if the web page performs additional redirects without user interaction. Code snippet from calling UIViewController that conforms to SFSafariViewControllerDelegate: let config = SafariViewController.Configuration() config.entersReaderIfAvailable = false let vc = SFSafariViewController(url: url, configuration: config) vc.delegate = self self.safariViewController = vc print(self.safariViewController?.delegate) self.present(vc, animated: true) Did something change? How can I make this consistent again?
1
0
314
Jun ’24
PaymentRequest TypeError
Details at Stack Overflow We're trying to enable Apple Pay on the Web for a web application of ours, but getting this error when trying to construct the PaymentRequest object: TypeError: Type error: PaymentRequest@[native code] startApplePay@https:-myurl-:319:47 onclick@https://-myurl-:606:14:undefined
1
0
329
Jun ’24
JavaScript Not Executing in WebView When Modally Presenting UIViewController on iOS 17.5.1
Issue Summary: I have encountered an issue where JavaScript does not execute in a WebView when another UIViewController is presented modally with modalPresentationStyle.fullScreen. This problem only occurs on physical devices running iOS 17.5.1. The issue is not present on iOS 17.5 simulators or devices running iOS 17.4.1 or earlier. Reproduction Steps: Create a ViewController with a WebView. Load a web page (e.g., https://apple.com) in the WebView. Present another ViewController modally with modalPresentationStyle.fullScreen. Verify that JavaScript execution in the initial WebView stops working. Test Code: import UIKit import WebKit class ViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Set up the WebView let configuration = WKWebViewConfiguration() let webView = WKWebView(frame: view.frame, configuration: configuration) view.addSubview(webView) webView.frame = view.frame if #available(iOS 16.4, *) { webView.isInspectable = true } else { // Fallback on earlier versions } webView.load(URLRequest(url: URL(string: "https://apple.com")!)) } override func viewDidAppear(_ animated: Bool) { super.viewDidAppear(animated) let navigationController = UINavigationController(rootViewController: TargetViewController()) navigationController.modalPresentationStyle = .fullScreen present(navigationController, animated: true) } } class TargetViewController: UIViewController { override func viewDidLoad() { super.viewDidLoad() // Set up the WebView let webView = WKWebView(frame: view.frame, configuration: WKWebViewConfiguration()) view.addSubview(webView) webView.frame = view.frame if #available(iOS 16.4, *) { webView.isInspectable = true } else { // Fallback on earlier versions } webView.load(URLRequest(url: URL(string: "https://apple.com")!)) } } Observations: The JavaScript within the WebView stops executing only on physical devices running iOS 17.5.1. This issue does not occur on the iOS 17.5 simulator. Devices running iOS 17.4.1 or earlier do not experience this issue. Request for Assistance: Could you please provide any insights or potential workarounds for this issue? Additionally, if this is a known bug, any information on upcoming fixes would be highly appreciated. Thank you.
2
0
412
Jun ’24
SFSafariViewControllerDelegate method for initialLoadDidRedirectTo not being triggered for subsequent reloads as specified in the docs
For some reason, not all of the time but most of the time, the SFSafariViewControllerDelegate method for initialLoadDidRedirectTo is not being triggered for subsequent reloads as specified in the docs. @discussion This method may be called even after -safariViewController:didCompleteInitialLoad: if the web page performs additional redirects without user interaction. I am allowing a user to log in with an OAuth 2.0 Provider on the Safari browser and expecting to detect the redirect to continue the flow from the app once their credentials have securely been consumed by the IdP in Safari. It was working consistently. It went from a 100% success rate up until this week to maybe 1/20 successful redirects. Code snippet: let config = SafariViewController.Configuration() config.entersReaderIfAvailable = false let vc = SFSafariViewController(url: url, configuration: config) vc.delegate = self self.safariViewController = vc print(self.safariViewController?.delegate) self.present(vc, animated: true) Why is it not always detecting the redirects?
1
0
353
Jun ’24
iOS 17.5.1 not updating permisions.
In this version of iOS our web extension is not allowed to run after allowing it run on all sites via clicking the aA icon in safari. Quitting safari makes it work so it is like the permisions are set but the extension code is never injected into the browser, this behaviour has been replicated with multiple different extension form different vendors.
0
0
245
Jun ’24
Safari DNR API timing issues
I created a Xcode project to test the DNR updateDynamicRules API performances on Safari (MacOS). https://github.com/radiolondra/TestUpdateDynamicRules Following the instructions in the README file, it's possible to test the extension on Chromium and Firefox browsers (on Windows). The project uses 2 json files containing static rules, enabled by default in the manifest file. These static rules are automatically installed in the browser when the extension is installed. Using the extension popup it is possible to add/remove just one very simple dynamic rule in the browser, a rule that acts on a predefined test domain (https://iana.org). What we want to measure is the time it takes for each browser to add/remove that one dynamic rule. The results for Safari are unacceptable to say the least: Safari: from 6000 to 8000 MILLISECONDS (6/8 seconds!) <<<<<<<<< Chrome: from 5 to 6 MILLISECONDS Firefox: from 5 to 7 MILLISECONDS Notice the time needed by Safari... It would be a good idea to take a look at this monstrosity. Thanks.
5
0
489
May ’24
Safari History Delete ISSUE
My Safari Web Extension uses a service worker and an IndexedDB database (IDB). For what hidden reason or perverse logic when deleting the Safari history all service workers are brutally shutted down and the database emptied of all its contents? And I heard about local storage too... It happens all the time in Safari macOS and iOS. Safari is the only browser in the world that takes the liberty of deleting what it shouldn't. Good Job indeed.
1
0
376
May ’24
WebKit WebKit::WebURLSchemeTask::stop()
1.WebKit WebKit::WebURLSchemeHandler::stopTask(WebKit::WebPageProxy&, unsigned long long) + 80 2.WebKit WebKit::WebURLSchemeHandler::stopTask(WebKit::WebPageProxy&, unsigned long long) + 80 3.WebKit WebKit::WebURLSchemeHandler::stopAllTasksForPage(WebKit::WebPageProxy&) + 108 4.WebKit WebKit::WebPageProxy::stopAllURLSchemeTasks() + 260 5.WebKit WebKit::WebPageProxy::close() + 1168 6.WebKit -[WKWebView dealloc] + 128 7.XHBUIKit -[XHBWebView dealloc] + 84 8.Foundation _NSKVODeallocate + 184 WKWebView 在dealloc 时崩溃,我该怎么处理。
1
0
214
May ’24
iOS 17.5.1 Xcode WebKit Crash
iOS 17.5.1 Xcode WebKit Crash Hello, I have two iPhone devices that I have. These devices are iOS17.5.1, and all Wk related codes cause Crash. Crash occurs when Xcode Build is complete and the app is running. If you run without connecting to Xcode, Crash does not occur. Error: Thread 1: EXC_BREAKPOINT (code=1, subcode=0x19e88fa18) Xcode 15.4, MacBook Pro 14 Sonoma 14.5 There was no issue with iOS 16.5. WKWebsiteDataStore.default() .fetchDataRecords(ofTypes: WKWebsiteDataStore.allWebsiteDataTypes()) { records in records .forEach { WKWebsiteDataStore.default() .removeData(ofTypes: $0.dataTypes, for: [$0], completionHandler: {}) } } let webConfiguration = WKWebViewConfiguration()webConfiguration.preferences.javaScriptCanOpenWindowsAutomatically = true
0
0
521
May ’24
WKWebView inline media playback issue
I have enabled inline media playback with code as below: let config = WKWebViewConfiguration() config.mediaTypesRequiringUserActionForPlayback = [] config.allowsInlineMediaPlayback = true let webView = WKWebView(frame: .zero, configuration: config) But when user touch play button on the video, it's automatically stopped the video and print out some errors as below: 2023-03-30 08:28:46.961218+0700 [22319:217776] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}> 2023-03-30 08:28:46.961404+0700 [22319:217776] [ProcessSuspension] 0x14dfe8820 - ProcessAssertion: Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=22415, error: Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)} 2023-03-30 08:28:46.966357+0700 [22319:217776] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}> 2023-03-30 08:28:46.966553+0700 [22319:217776] [ProcessSuspension] 0x14dfe8870 - ProcessAssertion: Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=22319, error: Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)} 2023-03-30 08:28:46.968951+0700 [22319:217776] [assertion] Error acquiring assertion: <Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)}> 2023-03-30 08:28:46.969615+0700 [22319:217776] [ProcessSuspension] 0x14dfe88c0 - ProcessAssertion: Failed to acquire RBS assertion 'WebKit Media Playback' for process with PID=22422, error: Error Domain=RBSServiceErrorDomain Code=1 "(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)" UserInfo={NSLocalizedFailureReason=(originator doesn't have entitlement com.apple.runningboard.assertions.webkit AND originator doesn't have entitlement com.apple.multitasking.systemappassertions)} What's the solution for this issue? Please help!
4
0
1.6k
Mar ’23
iOS17.5 WKWebView
Recently, our app has received feedback that WKWebview will get stuck when opening some web pages, and then the entire web page in the app will have problems opening. The feedback group is iOS17.5 or iOS17.5.1, other systems do not have this problem. Have you ever encountered such problems? and what direction should be taken to solve this problem?
2
1
606
May ’24
Safari crash when open tab in preview.
Hello there. 👋🏻 Recently I updated macOS and Safari to latest versions. And after that, Safari crashed randomly, but exactly when I open tab in preview by long tab on link. I tried uninstall all extensions and clean all caches and another trash – it not helps me. Any idea? Thank you in advance!
2
1
621
May ’24
Browser.permissions.request not working as expected
Hi there - I am trying to port over Chrome extension over to Safari Web extension. Looks like Safari has a very aggressive permissions flow which isn't a great user experience but I get the privacy benefits. I am trying to move some of my permissions like <all_urls> or tabs as optional permissions and build a flow where I can request the user for them in hopes that i can educate them as to why I need them similar to how Chrome/FF have it. However when i use browser.permissions.request - i always end up getting true without invoking the prompt. The prompt seems to come up regardless when i start visiting a website. Can someone help with this? Sounds more like a defect in Safari.
2
0
1.1k
Mar ’22
It's not possible to open a link in a new tab on a page with the "safari-web-extension://someurl..." protocol
I have an extension that opens the start page after installation with the URL: safari-web-extension://my-web-extension-page.html It's not possible on this page to open any link on a new tab if the link has attribute target="_blank" or even with "Command (⌘) + click" combination Are there any restrictions on pages with protocol safari-web-extension://?
2
1
649
May ’24
JavaScriptCore Crash in iOS17.4.1
Our app collected some JavaScriptCore crash information on iOS17 and above systems, but the cause of the error cannot be located. The crash stack is as follows: #27 Heap Helper Thread SIGSEGV 0 JavaScriptCore JSC::MarkedBlock::aboutToMarkSlow(unsigned int) 1 JavaScriptCore JSC::JSFinalObject::visitChildren(JSC::JSCell*, JSC::SlotVisitor&amp;amp;) 2 JavaScriptCore JSC::JSFinalObject::visitChildren(JSC::JSCell*, JSC::SlotVisitor&amp;amp;) 3 JavaScriptCore JSC::SlotVisitor::drain(***::MonotonicTime) 4 JavaScriptCore JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode, ***::MonotonicTime) 5 JavaScriptCore ***::SharedTaskFunctor&amp;lt;void (), JSC::Heap::runBeginPhase(JSC::GCConductor)::$_15&amp;gt;::run() 6 JavaScriptCore ***::ParallelHelperClient::runTask(***::RefPtr&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt;, ***::RawPtrTraits&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt; &amp;gt;, ***::DefaultRefDerefTraits&amp;lt;***::SharedTask &amp;lt;void ()&amp;gt; &amp;gt; &amp;gt; const&amp;amp;) 7 JavaScriptCore ***::ParallelHelperPool::Thread::work() 8 JavaScriptCore ***::Detail::CallableWrapper&amp;lt;***::AutomaticThread::start(***::AbstractLocker const&amp;amp;)::$_0, void&amp;gt;::call() 9 JavaScriptCore ***::Thread::entryPoint(***::Thread::NewThreadContext*) 10 JavaScriptCore ***::wtfThreadEntryPoint(void*) 11 libsystem_pthread.dylib __pthread_start #1 Queue: com.apple.main-thread SIGSEGV 0 libobjc.A.dylib _objc_msgSend 1 UIKitCore -[UIView(Geometry) convertPoint:toView:] #24 JSC Heap Collector Thread SIGSEGV 0 libsystem_kernel.dylib ___psynch_cvwait 1 libsystem_pthread.dylib __pthread_cond_wait 2 JavaScriptCore ***::ThreadCondition::timedWait(***::Mutex&amp;amp;, ***::WallTime) 3 JavaScriptCore ***::ParkingLot::parkConditionallyImpl(void const*, ***::ScopedLambda&amp;lt;bool ()&amp;gt; const&amp;amp;, ***::ScopedLambda&amp;lt;void ()&amp;gt; const&amp;amp;, ***::TimeWithDynamicClockType const&amp;amp;) 4 JavaScriptCore bool ***::Condition::waitUntilUncheckedWTF::Lock(***::Lock&amp;amp;, ***::TimeWithDynamicClockType const&amp;amp;) 5 JavaScriptCore JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode, ***::MonotonicTime) 6 JavaScriptCore JSC::Heap::runConcurrentPhase(JSC::GCConductor) 7 JavaScriptCore JSC::Heap::runCurrentPhase(JSC::GCConductor, JSC::CurrentThreadState*) 8 JavaScriptCore JSC::Heap::HeapThread::work() 9 JavaScriptCore ***::Detail::CallableWrapper&amp;lt;***::AutomaticThread::start(***::AbstractLocker const&amp;amp;)::$_0, void&amp;gt;::call() 10 JavaScriptCore ***::Thread::entryPoint(***::Thread::NewThreadContext*) 11 JavaScriptCore ***::wtfThreadEntryPoint(void*) 12 libsystem_pthread.dylib __pthread_start #25 Heap Helper Thread SIGSEGV 0 libsystem_kernel.dylib ___psynch_cvwait 1 libsystem_pthread.dylib __pthread_cond_wait 2 JavaScriptCore ***::ThreadCondition::timedWait(***::Mutex&amp;amp;, ***::WallTime) 3 JavaScriptCore ***::ParkingLot::parkConditionallyImpl(void const*, ***::ScopedLambda&amp;lt;bool ()&amp;gt; const&amp;amp;, ***::ScopedLambda&amp;lt;void ()&amp;gt; const&amp;amp;, ***::TimeWithDynamicClockType const&amp;amp;) 4 JavaScriptCore bool ***::Condition::waitUntilUncheckedWTF::Lock(***::Lock&amp;amp;, ***::TimeWithDynamicClockType const&amp;amp;) 5 JavaScriptCore JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode, ***::MonotonicTime) 6 JavaScriptCore ***::SharedTaskFunctor&amp;lt;void (), JSC::Heap::runBeginPhase(JSC::GCConductor)::$_15&amp;gt;::run() 7 JavaScriptCore ***::ParallelHelperClient::runTask(***::RefPtr&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt;, ***::RawPtrTraits&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt; &amp;gt;, ***::DefaultRefDerefTraits&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt; &amp;gt; &amp;gt; const&amp;amp;) 8 JavaScriptCore ***::ParallelHelperPool::Thread::work() 9 JavaScriptCore ***::Detail::CallableWrapper&amp;lt;***::AutomaticThread::start(***::AbstractLocker const&amp;amp;)::$_0, void&amp;gt;::call() 10 JavaScriptCore ***::Thread::entryPoint(***::Thread::NewThreadContext*) 11 JavaScriptCore ***::wtfThreadEntryPoint(void*) 12 libsystem_pthread.dylib __pthread_start #27 Heap Helper Thread SIGSEGV 0 libsystem_kernel.dylib ___psynch_cvwait 1 libsystem_pthread.dylib __pthread_cond_wait 2 JavaScriptCore ***::ThreadCondition::timedWait(***::Mutex&amp;amp;, ***::WallTime) 3 JavaScriptCore ***::ParkingLot::parkConditionallyImpl(void const*, ***::ScopedLambda&amp;lt;bool ()&amp;gt; const&amp;amp;, ***::ScopedLambda&amp;lt;void ()&amp;gt; const&amp;amp;, ***::TimeWithDynamicClockType const&amp;amp;) 4 JavaScriptCore bool ***::Condition::waitUntilUncheckedWTF::Lock(***::Lock&amp;amp;, ***::TimeWithDynamicClockType const&amp;amp;) 5 JavaScriptCore JSC::SlotVisitor::drainFromShared(JSC::SlotVisitor::SharedDrainMode, ***::MonotonicTime) 6 JavaScriptCore ***::SharedTaskFunctor&amp;lt;void (), JSC::Heap::runBeginPhase(JSC::GCConductor)::$_15&amp;gt;::run() 7 JavaScriptCore ***::ParallelHelperClient::runTask(***::RefPtr&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt;, ***::RawPtrTraits&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt; &amp;gt;, ***::DefaultRefDerefTraits&amp;lt;***::SharedTask&amp;lt;void ()&amp;gt; &amp;gt; &amp;gt; const&amp;amp;) 8 JavaScriptCore ***::ParallelHelperPool::Thread::work() 9 JavaScriptCore ***::Detail::CallableWrapper&amp;lt;***::AutomaticThread::start(***::AbstractLocker const&amp;amp;)::$_0, void&amp;gt;::call() 10 JavaScriptCore ***::Thread::entryPoint(***::Thread::NewThreadContext*) 11 JavaScriptCore ***::wtfThreadEntryPoint(void*) 12 libsystem_pthread.dylib __pthread_start Please help analyze and locate the cause. Has anyone else encountered this problem?
5
0
572
May ’24
In iOS version 17.4 and above, HTML rendering appears abnormal lines after refocusing
In iOS version 17.4 and above, we have observed that the following code works fine upon the initial opening. However, after minimizing the page and reopening it, there is a chance of encountering issues with abnormal lines. Please note the reproduction conditions: try minimizing the page, opening other apps, and then reopening it multiple times. The code is in the comments section. first time: After minimizing and reopening...
20
3
993
Apr ’24