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?
Post
Replies
Boosts
Views
Activity
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?
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'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.
I have a link that is embedded in the app using WKWebView. This link is working fine in the Macbook Safari browser, But it's not open in iPhone Safari and wkWebView in the app.
We are requesting some information on what should be done in the following case:
We have an application that has a privacy manifest, where tracking domains are listed. When the user does not give his/her consent to be tracked, non tracking domains are being used for requests to bring ads.
The application in question has a webview where content (ads) are loaded. When a user clicks on an ad, another webview is opened, and this webview does not know that it is in a non tracking flow. Therefore, tracking domains are being used instead of non tracking domains.
Since multiple redirections might be in play, there is no way to pass data from the original webview to the one that is opened once the ad is clicked.
Would the tracking domains being used in the second webview be blocked?
If so, what can we do to circumvent this scenario?
Is this even a use case considering privacy manifest?
Thanks
I have a mind mapping app that has been running well on Android for a few years now. I have been trying to publish it for iOS and MacOS for some time now. On iOS (as an app) and MacOS (in the browser for testing) I have a problem with the export. The app is a project in Angular, Cordova, Typescript. The problem only occurs in the Safari browser, which is also used in the Cordova version for iOS. I was able to test it on my Mac and an iPhone. The error does not occur on the Mac in Chrome.
The Problem
If I export a mind map that contains images as an image (.png), the images of the nodes are not displayed in the exports. Everything else in the map is exported correctly, only the images are missing. Only when I export the map three times are the images present in the export. If I add a new image and export it again, the image is only visible in the exported image after 3 exports. It is interesting that the export as SVG, which I also offer, contains the images of the nodes. So the SVG string that I create has all the necessary information.
The base
The mind map consists of various things. HTML and CSS for the frames, lines etc... The images of the nodes are saved as Base64 and each node is in a Foreign Object.
Example of the SVG export
Mindmap with 2 nodes and the Base64 characters of the node images have been replaced with ***.
__
SVG-String.txt
Attached because otherwise too long.
This is how I export the .png file.
I can view all this content in the map view of the app. When exporting to an image, I take this information, turn it into an SVG, have the browser draw it on the canvas and then output it as a graphic. Something must be going wrong at this point.
private exportAsImage(
mindMap: MindMap,
scale?: number,
type: string = "png"
): Observable<any> {
return new Observable(o => {
this.progress.start(this.progress.PROGRESS_MAJOR);
this.mmpMap.export(this.mapVizService.getExportClassList(mindMap),
(svgStr: string) => {
this.exportService.imageFromSVGString(svgStr, type, scale).pipe(
switchMap(img =>
of(
Utils.dataURItoFileObject(
img.dataUri,
`${Utils.sanitizeFilename(mindMap.title)}.${type}`
)
)
),
switchMap((fileObject: FileObject) =>
this.mapsService.saveAsTemp(fileObject, true, {
message: this.translate.instant("mdz.mindmap.saveas.message"),
// subject: this.translate.instant("mdz.mindmap.saveas.subject"),
subject: fileObject.name,
url: `www.myURL.com`
}, true)
)
).subscribe(() => {
this.progress.stop(this.progress.PROGRESS_MAJOR);
o.next();
o.complete();
}, err => {
this.progress.stop(this.progress.PROGRESS_MAJOR);
o.error(err);
o.complete();
});
})
});
}
What I have already tried.
I have already tested various things such as time delays etc..., none of which change anything. It seems to me that it's a combination of the caching and the order or speed at which the images are loaded. Only the speed can't be, because built-in delays don't change anything.
My guess
But it must have something to do with Safari because on the Mac in Chrome it runs without problems... Maybe it can't handle so many base64 images or it exports faster than it renders? Whereby the SVG export contains all the information and when I open the SVG, all the content is also displayed in the browser in seconds. So something must happen when painting on the canvas and outputting as an image.
It doesn't really make sense, I'm really at the end of my ideas. What can you do?
I really hope you can help me. A mind mapping app without image export makes little sense. And since the app otherwise works great, I'm really getting desperate. :(
Thanks a lot!
Rob
If you write about multiple lines when entering code into the prompt, it will be open, but there is no way to check the topmost written code.
It does not expose 1 to 3 lines, nor does it provide scrolling.
I think it should work like Google Chrome or there should be a way to solve this within safari.
If there's any way I don't know, please help.
I created a PWA that requires access to users' geolocation to perform a certain action in the system. The correct operation would be the user opens the application, and then the operating system prompts them to allow sharing their exact location with the PWA. However, this is not happening with a few users who have iPhone 11 or XR.
I tested it on iPhones 14, 13, 11 Pro, and even iPhone 6, and it works as expected. I directly spoke with a user who was experiencing the problem and conducted some tests.
I checked if location access was allowed in the settings.
I verified if Safari was accepting with the option to always ask selected.
In the settings of my system's website, I checked if location access was allowed with the option to always ask chosen.
We changed all prompting options to allow.
We opened the following site https://whatpwacando.today/ and found that geolocation was also not possible.
Everything indicates that the issue lies with these users' phones; however, other geolocation methods work fine, as other geolocation apps function properly. This leads me to think that it might be a problem with Safari not working properly with the HTML Geolocation API.
I'm not sure if there are any more advanced settings that could help or if anyone else has encountered this issue.
Hello,
I have noticed an issue when using my web application via TestFlight on iOS devices. When I try to print through the application, a message "This action will take you outside the app, press OK to continue" appears. This message prevents the user from printing documents from the application.
Steps to reproduce the issue:
Open my web application via TestFlight on an iOS device.
Press the print button in the application.
Expected behavior:
It is expected that the user can print documents from the web application via TestFlight without any obstacles.
Actual behavior:
When pressing the print button, a message "This action will take you outside the app, press OK to continue" appears, preventing printing.
I'm currently trying to add an OIDC connection to an iOS application. I'm using AppAuth, which will use ASWebAuthenticationSession (because we're targeting recent versions of iOS).
We have a login web page that will write a cookie. We'd like this cookie to be shared between the application (using ASWebAuthenticationSession) and the system browser (Safari) so that the user can be recognized and avoid having to log in again.
The web page writes a permanent cookie (with an expiry date) and the iOS application uses ASWebAuthenticationSession. And I did not set prefersEphemeralSession to true.
So we should be OK with the documentation (SFSafariViewController no longer shares cookies, and session cookies are not shared between ASWebAuthenticationSession and Safari).
It should work, if I understand the documentation correctly. Did I miss a point? Or is it a known problem?
I also tried to create a simple web page that read and write a cookie to do dome tests.
function writeCookie() {
var value = "something";
var maxAge = "max-age=" + (365 * 24 * 60 * 60);
var expiration = new Date();
expiration.setTime(expiration.getTime() + (365 * 24 * 60 * 60 * 1000));
var expires = "expires=" + expiration.toUTCString();
var sameSite = "SameSite=None";
var secure = ";Secure";
document.cookie = cookieName + "=" + value + ";" + maxAge + ";path=/;" + sameSite + secure;
}
function readCookie() {
var cookies = document.cookie.split(';');
var value = "";
for (var i = 0; i < cookies.length; i++) {
var cookie = cookies[i].trim();
if (cookie.indexOf(cookieName) == 0) {
value = cookie.substring(cookieName.length + 1, cookie.length);
break;
}
}
if (value !== "") {
alert("Cookie value : " + value);
}
}
And iOS code:
currentAuthorizationFlow = OIDAuthState.authState(byPresenting: request, presenting: viewController) { authState, error in
if let authState = authState {
print("Authorization succeed")
self.authState = authState
if let accessToken = authState.lastTokenResponse?.accessToken, let idToken = authState.lastTokenResponse?.idToken {
completion(.success(TokenResponse(accessToken: accessToken, idToken: idToken)))
return
}
}
self.authState = nil
completion(.failure(error))
}
Hi. I plan to use a WebView in an iOS app (SWIFT) and this should run a web app with WASM and using IndexedDB for permanent credentials.
I found rumors and information on Apple deleting data in IndexedDB and localStorage after 7 days (see links below). But I found no official information that tells me if this is true for my WebView in my ordinary mobile App (not PWA).
A test cycle over a week to find out is hard to do...
Is there any reliable and clear information on this and am I affected?
Thank you!
.
Links about this topic:
https://news.ycombinator.com/item?id=28158407
https://www.reddit.com/r/javascript/comments/foqxp9/webkit_will_delete_all_local_storage_including/
https://searchengineland.com/what-safaris-7-day-cap-on-script-writeable-storage-means-for-pwa-developers-332519
hi.
I've come across a UI-related bug. It's not a critical issue, but I'm curious whether it's actually a bug or an intended result.
Enable "Dark Mode" on your device.
Set Safari to "single tab" mode in the settings.
Open the iOS browser.
Switch to "Private Browsing" mode.
When swiping up, the background of the top toolbar (including the status bar) becomes translucent, revealing the content behind it.
When I turn on the 'Reduce Transparency' setting, the issue does not occur, and the background content remains hidden as expected.
iPhone12 mini / iOS 17.0.1
thx!
Since updating to iOS v17.4.1 our safari extension no longer functions as it used to
We are experiencing issues where our content script is not getting initialized, On devices running iOS 17.4.1, the content script included in our extension does not appear to run. There are no logs from the content script in the console, whereas on other versions and devices, it operates as expected. Our Extension relies con communication between the background and content scripts in order for us to render various popups to our users, based on our logs as of iOS 17.4.1 this communication is not successful, we can see messages being sent from the background script but as mentioned above nothing on the content script side.
This behavior happens majority of the time and on random sites, sometimes opening the same site in a new tab would work but not always. There are also times where we would only receive our popups after opening the safari menu and interacting with our extension via this menu.
Please assist with a way forward
At my work we are making a React App with Tailwind CSS. ever since the new update, safari has been going dark seemingly randomly across the interface.
Has anyone else experienced this or found out what may be causing safari to do this?
I am currently developing an iOS app that needs to embed a third-party website. On this website, the best view is achieved in the standard Safari app by pressing the 'Aa' button on the left side of the address bar and setting the zoom to 50%.
I want to replicate this 50% scaling in WKWebView, but I'm not sure how to accomplish it.
I've tried using
webView.pageZoom = 0.5
and setting
webView.scrollView.minimumZoomScale = 0.5
webView.scrollView.maximumZoomScale = 0.5
but it doesn't display the same way as it does in Safari.
How can I achieve the same scaling effect in WKWebView?
Good evening, I am having problems with my WebRTC application when an iPhone or Macbook is connected. This only happens when an iPhone or Macbook is connected, as tests with Windows or Android devices have shown no issues.
As can be seen in the screenshot below, it appears that the datachannel is not initialised correctly. In fact, the webcam and microphone do not work even if permissions are given by the user, and messages and the remote webcam are not sent/shown.
If I open chrome console on Windows, this is the error I get in the console
Could you please help me investigate this problem. If you want, you can have full access to my application at https://www.fourmeet.it. I attach the functions that seem to be responsible for the problems:
const configuration = {
iceServers: [...turnServers, { urls: 'stun:stun.1und1.de:3478'}],
iceTransportPolicy: 'relay'
};
peerConection = new RTCPeerConnection(configuration);
dataChannel = peerConection.createDataChannel("chat");
peerConection.ondatachannel = (event) => {
const dataChannel = event.channel;
dataChannel.onopen = () => {
console.log("peer connection is ready to receive data channel messages");
};
dataChannel.onmessage = (event) => {
console.log("message came from data channel");
const message = JSON.parse(event.data);
ui.appendMessage(message);
};
};
peerConection.onicecandidate = (event) => {
console.log("geeting ice candidates from stun server");
if (event.candidate) {
// send our ice candidates to other peer
wss.sendDataUsingWebRTCSignaling({
connectedUserSocketId: connectedUserDetails.socketId,
type: constants.webRTCSignaling.ICE_CANDIDATE,
candidate: event.candidate,
});
}
};
peerConection.onconnectionstatechange = (event) => {
if (peerConection.connectionState === "connected") {
console.log("succesfully connected with other peer");
}
};
const stringifiedMessage = JSON.stringify(message);
if (dataChannel && dataChannel.readyState === 'open') {
dataChannel.send(stringifiedMessage);
} else {
console.log('canale non aperto');
}
};
I have a page that needs to display a large PNG image (1024 x 100247 )
Everything works fine in Chrome and Edge, but failed in safari.
this is test image :
https://storage-staging.passton.jp/images/2024/03/11/E0R6G8FKd3B3iLPO.png
is there any limit in safari ?
Since iOS 17.4 when open a camera in Safari, video stop when download popup appear and video doesn't restart expect when go to home menu and reopen Safari
This comportment wasn't present before 17.4
To Reproduce : https://zcqqjd.csb.app/
Step 1 : Click on start Camera
Step 2 : Click on Download Picture
Our app uses Azure B2C for SSO login, and we are noticing a bug on Safari 17.x (any browser on iOS 17.x, and Safari 17 on Mac OS) where the Azure B2C cookies go missing during the registration process, which leads to a broken user experience.
The following cookies are the ones that go missing
The only forum posts related to this issue I have come across are these:
https://techcommunity.microsoft.com/t5/azure/azure-app-on-ios-17-not-working/m-p/3958809
Which links to this https://techcommunity.microsoft.com/t5/intune-customer-success/day-zero-support-for-ios-ipados-17-and-macos-14/ba-p/3930010
Is this in bug that will be fixed in an upcoming release on Safari 17.x?