Hello,
I'm using Safari 18.2 on Sonoma 14.6.1.
I was using the Developer Tools to do a Local Request Override in the Source tab for a CSS file that had a changing query string. I thought I had a good regular expression to catch all variants, but apparently it was too generic and possibly wrong, and made both Source and Network tabs no longer work in my Safari.
The regular expression I entered for the Local Request Override was: //build/style.css(?.*)?$
Now my dev tools is broken to the extent that the Source and Network tabs no longer work. The slide-out panel on Source that shows Breakpoints, LocalOverrides, etc no longer shows. The toggle for it does, but does nothing now. UI in general looks a little wack on both tabs.
So, since I can't turn off the Local Request Override, I've been trying to locate where Safari may have stored it to manually delete it. Not having a lot of luck on that front.
It seems to me that Safari was unable to escape my regular expression correctly and it then causes additional issue. Just a guess though.
Any advice or help in getting Safari Source & Network working again / manual removal of the LocalOverride would be greatly appreciated. I'm fluent in OSX and Linux, but grep was not much help surfacing anything that worked.
Thanks in Advance, possibly a Safari bug as well.
WebKit
RSS for tagDisplay web content in windows and implement browser features using WebKit.
Posts under WebKit tag
200 Posts
Sort by:
Post
Replies
Boosts
Views
Activity
Having the app localised and configured to Dutch from Belgium (nl_BE), I open a url with WKWebView. The website locale detects Dutch from Netherlands (nl_NL)
Hi,
Iām encountering an unexpected issue in Safari. Specifically, navigator.clipboard.writeText() fails when called from a content script in my extension immediately after sending a message to background.js while it works fine in Chrome and Firefox. Is this expected?
Environment
Safari
18.2 (20620.1.16.11.8)
Technology Preview 210
macOS Sequoia 15.2 (24C101)
Example
This is a minimal reproducible example, which adds a button to example.com:
https://github.com/mshibanami/ClipboarAPIIssueExample
Below is the related code:
// content.js
copyButton.addEventListener('click', async () => {
// šļø This call seems to trigger the issue
await chrome.runtime.sendMessage({});
try {
await navigator.clipboard.writeText(text);
alert(`ā
Copied '${text}' to clipboard!`);
} catch (err) {
alert(err + '\n\n' + `navigator.userActivation.isActive: ${navigator.userActivation.isActive}`);
}
});
// background.js
chrome.runtime.onMessage.addListener(() => { });
When I click the button, I expect the text to be copied successfully. However, I receive an error in Safari.:
Interestingly, if I remove chrome.runtime.sendMessage(), the clipboard operation works without any problems. Also, note that navigator.userActivation.isActive is true, which might mean it's not related to the User Activation API.
Misc.
This might be related to another question I posted here:
https://developer.apple.com/forums/thread/772275
Hi,
I'm encountering an issue with the Clipboard API's writeText() method in Safari. It throws a NotAllowedError even when triggered by a user action (selecting an option from a <select> element). Is this expected?
This issue seems specific to Safari, as the same code works perfectly in Firefox and Chrome.
Perhaps I should send feedback to Apple, but I'd like to post it here first in case I misunderstand something.
Problem
In Safari, when I try to copy text to the clipboard using navigator.clipboard.writeText() within an input event listener attached to a <select> element, it fails with the following error:
NotAllowedError: The request is not allowed by the user agent or the platform in the current context, possibly because the user denied permission.
Environment
Safari
18.2 (20620.1.16.11.8)
Technology Preview 210
macOS Sequoia 15.2 (24C101)
Example
I've created a minimal reproducible example on CodePen: https://codepen.io/mshibanami/pen/LEPdxXZ
Here's the relevant JavaScript code from the example:
selectElement.addEventListener('input', async (event) => {
const selectedText = event.target.options[event.target.selectedIndex].text;
try {
await navigator.clipboard.writeText(selectedText);
alert(`Text copied to clipboard: ${selectedText}`);
} catch (err) {
alert('Failed to copy text to clipboard: ' + err);
}
});
Firefox and Chrome handle this code without any issues, successfully copying the text to the clipboard, but not Safari.
Possible Cause
I suspect this issue might be related to WebKit's User Activation API. It seems like Safari is not correctly recognizing the input or change event on a <select> element as a valid user activation for the Clipboard API, even though it is initiated by a user gesture.
Questions
Is this behavior unexpected? Should Safari allow the Clipboard API to work in this context?
(Technically, this might be expected as of now, as such events are not explicitly described in https://webkit.org/blog/13862/the-user-activation-api/.)
Any insights or suggestions would be greatly appreciated. Thanks!
I was in the webview long according to the pictures, and then select "save image" will lead to collapse, I have passed on the info plist add NSPhotoLibraryAddUsageDescription solved it.
Now I have another question, does the last item "query" in the screenshot have a similar problem? Since I couldn't click the button (I don't know why this happened), I couldn't test it on the real machine.
When WKWebView loads a site that has username and password on different pages, standard "Passwords" button above keyboard does nothing. Reproducible on both physical device and simulator. At the same time, Safari works fine in this case.
Any chance to fix this behavior in the upcoming iOS updates?
Here's video demonstrating the issue:
and a sample code to reproduce it (nothing specific, just bare WKWebView with default configuration):
class ViewController: UIViewController {
private let webView = WKWebView(frame: .zero)
override func viewDidLoad() {
super.viewDidLoad()
view.addSubview(webView)
}
override func viewDidLayoutSubviews() {
super.viewDidLayoutSubviews()
webView.frame = view.bounds
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
webView.load(URLRequest(
url: URL(string: "https://accounts.google.com/")!
))
}
}
I have a content blocker that generally works correctly, but I need to block an element that has certain text in it.
For example, <span id="theId">Some text</span> is easy enough to block because I can locate the id and block that, but what if there is no id, or the id is completely random? What if it's just <span>Some text</span>? How do I block that?
Let's say this is my only content blocker rule:
[
{
"action": {
"type": "css-display-none",
"selector": ":has-text(/Some text/i)"
},
"trigger": {
"url-filter": ".*"
}
}
]
No errors are seen when the rule is loaded, so it's syntactically correct, it just doesn't block the HTML. I gather this is because :has-text() works on attributes, not contents, so it works on alt, href, aria-label etc. but not on the contents of the element itself.
How do I block Some text in my example above? Thanks!
Hi,
Our company has an application uses the WKWebview to host a lot of content.
The content is web based and hosts a lot of charts and metrics.
Because of the high content, we've seen the memory of the WebContent hit above 1.25 GB.
When that happens, it'll eventually terminate and we have our recovery code to reload the same page
Seems like the limit is hidden / internal. Some Apple devs also noted something might be hard coded to be limited as well.
Yes, we have our optimizations but we still need to keep our queries, use react, cache, etc... It's just a heavy web application.
Request:
Can you help us raise that limit?
Are there some limitations in Webkit for such a need to terminate?
As some devices have much higher RAM than before, we were hoping to be able to dynamically adjust the limit for the wkwebview before it resets.
We contacted our internal contacts but they said to post here.
Enhancement in managing tabs in Safari
It would really be awesome to bring the fascinating tab management feature of Arc Browser to Safari across iOS, iPadOS and macOS.
Especially below listed features;
Multitask
Create
Organize
Rev Up
Release Notes
For further info , here is the official link of Arc Browser, https://resources.arc.net/hc/en-us/categories/16435255982103-Features.
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 utmost importance and can directly help timely treatment action. The app we are developing uses multiple libraries and tools like vtk, webgl, opengl, webkit, gl-matrix etc.
The problem specifically can be described as follows, it has been observed that when 3D volume is rendered in the app and we try to rotate the volume the rotation is slow, unresposive and laggy. Specifically, we have noticed that iOS 18.1 the volume rotation is much smoother as compared to latest iOS 18.2. Eariler, we have faced somewhat similar issue with iOS 17 but it got improved in iOS 18.1. This performance regression is affecting the user experience in our healthcare application.
We have taken reference from the cornerstone.js code and you can reproduce the issue using the following example: https://www.cornerstonejs.org/live-examples/volumeviewport3d
Steps to Reproduce:
Load the above mentioned test example on an iPhone running version 18.2 using safari.
Perform volume rendering using the provided dataset.
Measure the time taken by volume for each rotate or drag action.
Repeat the same steps on an iPhone running version 18.1 for comparison.
Additional Information:
Device Model Tested:
iPhone12, iPhone13, iPhone14
iOS Version With Issue:
18.2
18.3(Beta)
I would appreciate any insights or suggestions on how to address this performance regression. If additional information is needed, please let me know.
Thank you.
Hello,
I am experiencing a performance regression in my application when rendering volumes on iPhone. Specifically, I have noticed that iOS version 18.2 takes significantly more time for each render cycle as compared to iOS 18.1.
Details:
Affected Versions:
iOS version 18.2
iOS version 18.1 (baseline for comparison)
Issue Description:
In iOS version 18.2, the time taken to render volumes has increased compared to iOS version 18.1. This performance regression is affecting the user experience in my application.
Test Example:
https://www.cornerstonejs.org/live-examples/volumeviewport3d
Steps to Reproduce:
Load the above test example on an iPhone running version 18.2 using safari.
Perform volume rendering using the provided dataset.
Measure the time taken by volume for each rotate or drag action.
Repeat the same steps on an iPhone running version 18.1 for comparison.
Additional Information:
Device Model Tested:
iPhone12, iPhone13, iPhone14
iOS Version With Issue:
18.2
18.3(Beta)
I would appreciate any insights or suggestions on how to address this performance regression. If additional information is needed, please let me know.
Thank you.
Hi everyone,
I'm facing an issue with accessing device orientation and motion events in Safari on my iPhone (iOS 18). Despite trying several guides and solutions, I cannot find the option to allow access to motion and orientation for websites in the browser settings. Iāve checked privacy settings, and the device is up to date. Can anyone guide me on how to enable this feature in Safari or share any workarounds? Thanks in advance!
I have been trying to integrate a UIKit view into SwiftUI, specifically a WKWebView. However, I keep encountering a does not conform to protocol error.
Here's my code:
import SwiftUI
import WebKit
struct SimpleWebView: View {
var body: some View {
WebViewContainerRepresentable()
.edgesIgnoringSafeArea(.all)
}
}
struct WebViewContainerRepresentable: UIViewRepresentable {
typealias UIViewType = WKWebView
func makeUIView(context: Context) -> WKWebView {
let webView = WKWebView()
if let url = Bundle.main.url(forResource: "index", withExtension: "html") {
webView.loadFileURL(url, allowingReadAccessTo: url.deletingLastPathComponent())
}
return webView
}
func updateUIView(_ uiView: WKWebView, context: Context) {
// Updates not required for this use case
}
}
I tried this with other views as well, and it turns out this is not WKWebView-specific.
The minimum deployment version is iOS 15.
Any help would be much appreciated. Let me know if I need to add any more information.
We have a web application that uses high resolution images to validate the authenticity of products. For this purpose we want to use the best camera to make the high resolution camera, on iPhone Pro devices this camera is the ultra-wide angle camera. The issue we have is how to confidently select that camera from the list returned by navigator.mediaDevices.enumerateDevices. We can't use the device ID as it change every time (and for every user), we could use the camera name but the string is translate to the device language which is very problematic. We could also just select a specific item in the list but we are not sure that the order is preserved and it makes it hard to deal with other iPhone models that don't have that ultra wide angle camera.
Selecting a specific camera looks like an essential feature not only for us. What is the best option, we are looking for something that is future proof and easily scalable.
I am working on task to add WKWebView to Autofill extension. This web view presents web content that can access camera feed.
As an example here is a simple html:
I have added Camera permission entitlements to both main app and autofill extension Info.plist
Camera feed is accessed properly from the main app. However, doing the same in the Autofill extension does not show Camera stream in the web content.
I am receiving camera permissions alert and am allowing permissions.
It just stucks on the black screen and in console I see these logs:
16000a00 - GPUProcessProxy::didClose:
0x116000a00 - GPUProcessProxy::gpuProcessExited: reason=Crash
0x1150180c0 - [PID=1Ā 523] WebProcessProxy::gpuProcessExited: reason=Crash
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}>
0x115020360 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'GPUProcess Background Assertion' for process with PID=1Ā 524, 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}
0x1160012a0 - GPUProcessProxy::didClose:
0x1160012a0 - GPUProcessProxy::gpuProcessExited: reason=Crash
0x1150180c0 - [PID=1Ā 523] WebProcessProxy::gpuProcessExited: reason=Crash
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}>
0x115020300 - ProcessAssertion::acquireSync Failed to acquire RBS assertion 'GPUProcess Background Assertion' for process with PID=1Ā 525, 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}
Looks like WKWebView crashes.
Here are my configurations for the WKWebView:
let webConfiguration = WKWebViewConfiguration()
webConfiguration.allowsInlineMediaPlayback = true
webConfiguration.mediaTypesRequiringUserActionForPlayback = []
let webView = WKWebView(frame: .zero, configuration: webConfiguration)
webView.navigationDelegate = self
webView.uiDelegate = self
webView.scrollView.isScrollEnabled = false
webView.contentMode = .scaleAspectFit
view.addSubview(webView)
Does anyone know what might be the problem?
Is it even possible to access Camera from web content in Autofill extension?
We enabled WebGPU feature flag on Safari on iOS 18.2. This does give Safari an access to GPU but WKWebView still doesn't have GPU access.
Can WKWebView not access GPU through Safari feature flag? Is there some other mechanism through which we can enable GPU access for WKWebView?
We are testing gpu access by loading : https://webgpureport.org/
Regards
Saalis Umer
Microsoft
Safari Feature Flag - webgpu = true
Safari GPU Access:
WKWebView GPU Access:
I am developing a authorization plugin for mac. i am using SFAuthorizationPluginView as i need a webView(WKWebKit) which will perform webAuthn. But the webview is not rendering the requested webpage( i have stable internet connectio). Is it an expected behaviour for a webview in an authorization plugin?
After updating my phone to iOS 18.2 2 days ago, I noticed that a website I'm working on that uses Rafael JS(https://dmitrybaranovskiy.github.io/raphael) to do some svg rendering which used to work before I updated just stopped working.
I notice that Safari tries to load website tries to load 2 or 3 times before showing the error: A problem repeatedly occurred on <website> which I find really odd since this used to work before and I haven't made any changes to the code.
This also happens in Chrome on iOS 18.2.
Is this technical solution reasonable about WKWebView on cross-domain issues ?
Hiļ¼all
My project use WKWebView to load offline package, such as .html/.css/.jsļ¼and also request some resources from remote server to update pages. So there is a cross-domain problem with local file(file://***) and remote domain (https://***), is this following technical solution reasonable to fix this problem:
1. Create a custom URLSchemeHandler which conforms to WKURLSchemeHandler
2.Unify local file and remote domain request to https request
3. Hook WKWebView https request
4. Implement WKURLSchemeHandler delegate method
(void)webView:(WKWebView *)webView startURLSchemeTask:(id)urlSchemeTask {
NSURL *url = urlSchemeTask.request.URL;
if ([url.pathExtension isEqualToString:@"html"]) {
NSData *data = [[NSData alloc] initWithContentsOfFile:localFilePath];
NSMutableDictionary resHeader = [NSMutableDictionary new];
[resHeader setValue:@"" forKey:@"Access-Control-Allow-Origin"];
[resHeader setValue:@"charset=UTF-8" forKey:@"Content-Type"];
[resHeader setValue:@"text/html" forKey:@"Content-Type"];
NSHTTPURLResponse *response = [[NSHTTPURLResponse alloc]
initWithURL:url statusCode:200 HTTPVersion:@"HTTP/1.1" headerFields:resHeader];
[urlSchemeTask didReceiveResponse:response];
[urlSchemeTask didReceiveData:data];
[urlSchemeTask didFinish];
} else {
NSURLSession *defaultSession = [NSURLSession sharedSession];
NSURLSessionTask *dataTask = [defaultSession dataTaskWithRequest:urlSchemeTask.request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
[urlSchemeTask didReceiveResponse:response];
[urlSchemeTask didReceiveData:data];
[urlSchemeTask didFinish];
}];
[dataTask resume];
}
}
Is this technical solution reasonable? and is there any issues that I haven't considered?
Sincerely,
Looking forward to your reply
I am currently publishing an application that uses WebView,
I am currently publishing an application that uses WebView, but I am having trouble with data in LocalStorage sometimes disappearing.
The website displayed in WebView is made with PHP,
By writing the following code in JavaScript,
When WKWebView is opened, localStorage is saved and retrieved.
window.localStorage.setItem('isAlreadyAgree', true);
window.localStorage.getItem('isAlreadyAgree');
The problem is that sometimes this getItem does not get the data.
ć»This is not reproducible and does not always occur when some process is performed.
ć»Is it possible that the storage of the application is cleared due to distribution using MDM?
ć»Is it possible to store too much data in UserDefault, which would cause the LocalStorage space to be overwhelmed and disappear?
I would appreciate any hints you can give me.
Thank you in advance.