We’ve received a lot of user complains after the latest iOS 17.4 update.
Our Safari extension does not work as reliably as it used to be (sometimes it’s just not loaded, or very slowly).
Is this a known issue?
Are any workarounds available?
On iOS 17.5 the problem seems to be fixed, but I’m still wondering for a workaround because we dont know how long until 17.5 is released.
General
RSS for tagExplore the integration of web technologies within your app. Discuss building web-based apps, leveraging Safari functionalities, and integrating with web services.
Post
Replies
Boosts
Views
Activity
Hello there!
At our company we have started to deal with an issue in the latest iOS (17.5) version.
It looks like the background script of the extension becomes unresponsive after a short amount of time (around 30 seconds) after performing more than one request to it within a range of 1 - 4 seconds.
How it can be tested? Pretty simple example:
// content.js
const t = 4000 // Using less than 4000ms makes background script unresponsive
async function requestNext() {
return browser.runtime.sendMessage({ greeting: "getNext" })
}
setInterval(async () => {
const n = await requestNext()
console.log("current is: " + n)
}, 4000)
// background.js
let counter = 0
browser.runtime.onMessage.addListener((request, sender, sendResponse) => {
console.log("Received request: ", request);
if (request.greeting === "getNext") {
counter++
sendResponse(counter);
return true
}
});
Whenever the browser.runtime.sendMessage is executed too fast the background script will stop working.
As far as we have been able to check this only can be reproduced after 17.4.1
I am re posting this issue, as a solution still hasn't been provided.
please see this original feedback ticket for all the details FB13744621
Any solution or workaround would be appreciated.
Thanks
I'm experiencing a Safari Web Extension issue where the non-persistant background script seems to crash after 30 seconds even when the content script is messaging it.
Here is a minimal-reproducible example. When running in an emulator, the background script will stay responsive forever. However, when running on a physical device, the background script becomes non-responsive after 30 seconds of activity. It never becomes responsive again until I toggle the extensions enable/disable toggle, after which it stays active for 30 seconds and then crashes again.
We had developed an iOS Safari web extension (which uses non-persistent background scripts) that functioned properly until iOS 17.3. However, I've encountered inconsistent behavior on iOS 17.4.1, 17.5, and 17.5.1. Upon further debugging, I noticed that the background scripts often become idle and are unloaded frequently. They are not loaded again even for the registered webNavigation events and only trigger when interacting with the extension popup menu. This is also mentioned here.
I had tried this in both manifest versions 2 & 3. I had tried using service_worker for background scripts. But, none of it seems to resolve this issue.
Could you please clarify if this is a bug or an intended behavior?
Our extension relies on webNavigation events without users having to interact with the popup menu often.
I want to execute the modifyHeaders method using a Safari extension. However, it doesn't work when I execute it in Safari. It works in Chrome. Why is that? I used this document as reference:
Part of manifest.json
"declarative_net_request": {
"rule_resources": [{
"id": "ruleset",
"enabled": true,
"path": "rules.json"
}]
},
"host_permissions": [ "<all_urls>" ],
"permissions": [
"declarativeNetRequestWithHostAccess"
]
rules.json
[
{
"id": 1,
"priority": 1,
"action": {
"type": "modifyHeaders",
"responseHeaders": [
{
"header": "Content-Disposition",
"operation": "remove"
}
]
},
"condition": {
"regexFilter": ".*",
"resourceTypes": [
"main_frame",
"sub_frame"
]
}
}
]
[https://developer.apple.com/documentation/safariservices/safari_web_extensions/blocking_content_with_your_safari_web_extension]
Hi i need help,
I‘m on macOS Sonoma 14.4 and My Integrated Wifi Chip is broken. I recently bought a BigTec 120 Wifi Stick but it isn‘t working. Maybe it isn‘t compatible with macOS but it could be that there is a „kext“ file for it.
Tom
We are trying to implement ad blockers using the Safari web extension, and we are implementing this using the declarativeNetRequest, with a manifest version 2. We have added a json file which contains a rule set for over 22000 URLs, does content blocker have a limit to the number of rules we set in json?
Although it does work fine, sometimes we see the behaviour different on simulators and on clearing the cache it works fine is this expected?
I have integrated the Safari Content Blocking extension, and it works perfectly on the first run, effectively blocking content on Safari. However, after re-installing the app, I occasionally encounter the following error, despite the content blocker functioning as expected:
"Failed to reload content blocker Error Domain=SFErrorDomain Code=3 "(null)""
What could be causing this intermittent error?
Hello I have a question about my Web App release. I have built a web app including Apple Music MusicKit JS. Now I would like to release it. Do I need to confirm this with Apple? If yes, what can I do next?
On iOS 17.5, when I push a new ViewController, after a while, the setInterval function in Wkwebview stops timing, which is normal on iOS 17.5 and below.
So I am trying to control the wkwebview content within my app. When I try the following code>
var backButton: some View {
Button(action: {
webView.goBack()
// Add your back button action here
}, label: {
Image(systemName: "arrow.uturn.backward")
.font(.title)
})
.navigationBarBackButtonHidden(true)
}
I get webView out of scope.
This is how I have webView implimented
struct WebView: UIViewRepresentable {
let url: URL
let preferences = WKPreferences()
let useragent = WKWebViewConfiguration()
func makeUIView(context: Context) -> WKWebView {
@State var webView = WKWebView()
let request = URLRequest(url: url)
useragent.applicationNameForUserAgent = "Version/1.2 LavaRock/1.2"
useragent.allowsAirPlayForMediaPlayback = true
useragent.allowsInlineMediaPlayback = true
useragent.allowsPictureInPictureMediaPlayback = true
//
preferences.isFraudulentWebsiteWarningEnabled = true
preferences.isSiteSpecificQuirksModeEnabled = true
preferences.isElementFullscreenEnabled = true
webView.allowsBackForwardNavigationGestures = true
// webView.configuration.allowsPictureInPictureMediaPlayback = true
webView.customUserAgent = "Mozilla/5.0 (iPhone; CPU iPhone OS 18_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148 Version/1.2 LavaRock/1.2"
webView.load(request)
return webView
}
func updateUIView(_ uiView: WKWebView, context: Context) {
// Handle view updates if needed
}
}
How should create the button?
Problem Details :
In the case of iOS, the image to be displayed in the pop-up message within the TypeScript application does not appear during file download.
An error occurred trying to load the resource when attempting to fetch the image (in the case of Safari).
The image does not appear in Edge or Chrome either, besides Safari. The image is displayed correctly on Windows 10, 11, Mac Ventura, Mac Sonoma, and Android.
Neither svg format nor png format images are displayed.
Only in the case of iOS, a download modal appears in Safari (In Edge and Chrome, a different display asking whether or not to download appears, which is different from the modal).
The issue only occurs when the download modal display and the image fetching for the pop-up are conducted simultaneously. If you delay the display of the download modal from the timing of fetching the image for the pop-up (apply a wait), the image can be fetched.
Verification Environment:
iOS v.17.5.1 Safari 604.1
iOS v.17.3 Safari 604.1
IOS v.17.4.1 Chrome 126.0.6478.54
IOS v.17.4.1 Edge: 125.0.2535.72
Consideration and Request:
Based on the problem details, I am considering that this issue might be a bug in iOS.
I would like to know from experts whether this event is a bug or a specification of iOS.
If there is any information about similar events occurring, I would like to know.
If there are any solutions, hints, or advice, I would appreciate it if you could provide them.
If additional information is required from me, I would like to be contacted.
Thank you for your cooperation.
We are developing an application using Safari extensions (iOS 16, 17).
When the Safari extension is enabled, it does not function properly in Safari.
On an iPhone, the issue can be temporarily resolved by repeating the following steps:
1.Go to "Settings" → "Safari" → "Extensions" and toggle the extension off and on.
2.Go to "Settings" → "Safari" → "Clear History and Website Data."
3.Restart the iPhone.
However, these methods do not consistently resolve the issue, and a definitive solution has not been identified.
Does the Safari extension's JavaScript have a caching mechanism?
If it does, what are the recommended methods to address this issue?
Has anyone attempted to render a WKWebView in a background or invisible UIView so that it’s visible immediately upon first presentation, and if so, what technique did you use?
Background:
We are trying to embed a WKWebView in our UI that renders seamlessly next to native UI. We are going to download a .ZIP file, unzip it locally to disk, and then point the WKWebView to that local file. However, when testing this solution on an iOS simulator (running iOS 17.5), we see a flash of white – specifically there is no content rendered for the first moment or two, followed by content appearing.
We have tried attaching the WKWebView to the UIWindow, adding a javascript callback for the onReadyStateChange “loaded” event, and then only proceeding to present our UIViewController containing our WKWebView afterwards, but we still see a moment with no content being rendered at all. If we add a delay using DispatchQueue.asyncAfter of approximately one second (anything less still flashes), our content does seem to be correctly rendered in the background and immediately visible when the UIViewController gets presented.
This is a problem that was originally asked nearly 11 years ago (https://stackoverflow.com/questions/15669809/how-to-prevent-initial-white-flash-when-showing-a-uiwebview); and the agreed upon solution there seems to be to set the background to be not opaque, but the issue remains that the content isn’t immediately visible. Google Gemini and ChatGPT have proposed a number of solutions, including hallucinations about headless WKWebView support on iOS, but unfortunately we are unable to achieve a solution without a DispatchQueue delay with a magic number.
navigator.permissions.query -> permissionStatus.onchange
is Supposed to listen to the event of a change in permissions in the
browser settings.
This works for all browsers, but in Safari for iOS and MacOS this seems to be broken in the currently recent versions 17.x
Example:
navigator.permissions.query({ name: 'notifications' }).then((permissionStatus) => {
permissions = permissionStatus.state; // this value gets set correctly
permissionStatus.onchange = () => {
// This will not get executed when permissions have been changed
// within the safari settings app, or iOS Settings for PWA or Safari
};
});
Can someone from Apple's Webkit Team please comment on this?
Thank you.
T.
When you have a blank Safari new tab open, the browser.tabs.query API inaccurately includes those tabs in results that include a url or title in the query options.
To reproduce, open several tabs, and a blank new tab. Open the background page devtools, and execute the following command:
browser.tabs.query({url: 'https://github.com/'}, console.log)
In addition to any potentially valid results (if you have github.com open, for example), there will also be an entry for the blank tab, which has an empty, non-matching URL.
Tab {
active: true,
audible: false,
height: 1095,
highlighted: true,
id: 6,
incognito: false,
index: 3,
isArticle: false,
isInReaderMode: false,
mutedInfo: {muted: false},
pendingUrl: "",
pinned: false,
status: "complete",
title: "", url: "",
width: 1792,
windowId: 1
}
I hope that this bug can be addressed, as it causes some unexpected behavior.
I see that on some sites (possibly many) the passkeys verification freezes when devtools are opening.
I tried to debug and see that it hangs in navigator.credentials.get.
STR:
Go to https://passkeys-demo.appspot.com/
Enter random username and click Next
Enter password and click Next
Create a Passkey.
Sign out.
Select USE ONE BUTTON SIGN-IN INSTEAD
Open dev tools.
Try to Sign in with passkey.
Expected result:
User successfully logged in - technically navigator.credentials.get returns credentials.
Actual Result:
navigator.credentials.get stucks in infinite loading and nothing happened - no any errors.
My assertion options looks like:
{
"challenge": "K8WztCaAZM5-ST7r198F6UD4iLZ09IINHSiDJBgHHq4",
"allowCredentials": [],
"timeout": 60000,
"userVerification": "preferred",
"rpId": "passkeys-demo.appspot.com"
}
In source code on this demo site the code
options.allowCredentials = []; <---- breakpoint hit here
// Invoke WebAuthn get
const cred = await navigator.credentials.get({
publicKey: options,
// Request a conditional UI
mediation: conditional ? 'conditional' : 'optional'
});
const credential = {}; <---- breakpoint NOT hit here (after removing breakpoint above and after macOS touch ID is completed)
We are using aws amplify for our social logins with signInWithRedirect.
When a user selects apple login on iphone and cancels the appleId popup, the user can't click any social login buttons anymore, including the apple one.
Refreshing the page resolves this.
I use this method.
webView.load(urlRequest)
but it seems the server receives empty httpBody.
I found threads about the simlar issue before iOS 11, but no recent one.
Is httpBody still ignored on iOS 17 and later?