If the extension uses manifest v3 and a background script in the form of a service worker, then in Safari it is not possible to open the background script debugging window. If I expand the Developer menu in Safari, there is nothing under Web Extension Background Data (or disappear after click), which is an error. In other browsers (Edge, Chrome, Opera, Firefox) this works correctly.
If I switch the background script back to non-persistent script mode, everything works fine and from the Developer menu and the Web Extension Background Data submenu I am able to open the background script debugging window for the extension. Am I doing something wrong?
Explore the integration of web technologies within your app. Discuss building web-based apps, leveraging Safari functionalities, and integrating with web services.
Selecting any option will automatically load the page
Post
Replies
Boosts
Views
Activity
After the first installation (out of AppStore) of the extension in the browser, the content script is correctly inserted into the page (twice for some reason) and a message is sent from the root of the content script to the background script, which responds correctly.
However, if an event handler is registered within the content script, within which the message is also sent to the background script, it will never reach the background script.
window.addEventListener("message", function (event) {
// We only accept messages from ourselves
if (event.source !== window) {
return;
}
if (event.data.source && event.data.source === appIdentification) {
browser.runtime.sendMessage(event.data);
}
}, false);
It does not matter with what delay the event handler is called (i.e. the background script is not asleep). If I refresh the page or close and reopen the browser and reload the page, everything works correctly and the message sent from the event handler is already delivered to the background script.
The event handler is used so that the extension code is uniform for all browsers (Chrome, Safari, Edge, Opera, Firefox), i.e. it is not intended to use externally_connectable for sending messages from the webpage directly to the background script, which Safari should support. The expected behavior is that the extension will work even after the first installation, as is the case with other browsers.
Procedure:
Enter the test website: https://www.mssf.cz/testapp/check_client.aspx
Do the initial installation of the extension (could be downloaded from here: https://1drv.ms/f/c/76f4c93826df41a0/Ej5MQX9ctyhHv_P9_t_6uAwB05ET-nzXuMhPeu56nOgkWg?e=cudqRJ)
Set a breakpoint in the event handler for "message" within the content script, open the background script and set a breakpoint in the event handler for onMessage
Click on the "Validate certificate" button on the page loaded in point 1
Step through the content script to the point where the message is sent to the background script, the breakpoint within the background script is never hit, which is an error, the message should come to the background script
I want to print the content of a WKWebView. I've done some searching, and many people have struggled with this over the years. Some claimed success, but their solutions don't work for me. One person created images for each pages and printed that, but then if you were to print to PDF, you'd get a PDF containing images rather than text.
If I just call the printView(_:)) method of the view, I get blank pages.
With the following more elaborate code, I get a partial printout, 11 out of what should be about 13 pages.
let info = NSPrintInfo.shared
info.topMargin = 72.0;
info.bottomMargin = 72.0;
info.leftMargin = 72.0;
info.rightMargin = 72.0;
info.isVerticallyCentered = false;
info.isHorizontallyCentered = false;
info.horizontalPagination = .fit;
info.verticalPagination = .automatic;
let printOp = webView!.printOperation( with: info )
printOp.canSpawnSeparateThread = true
printOp.view?.frame = NSMakeRect( 0, 0,
info.paperSize.width, info.paperSize.height )
printOp.runModal(for: webView.window!, delegate: self,
didRun: nil, contextInfo: nil )
When I run the above under the debugger, I see console messages saying
CGContextClipToRect: invalid context 0x0.
Once the print dialog appears, if I touch (but not change) the selected printer, then the page count changes to the correct value.
Hi folks!! Anyone here experienced issues with video not showing up in webview?
I have a simple index.html with a video tag but its doesn't load why?
We have a JavaScript api that queries our Secure Browser to get the network information – signal strength, network name, plugged in/wifi. Everything worked fine through the Tahoe betas, still does. Now we are getting on the network name and this is breaking our UI. Was this an intentional change or a bug? The other two properties still appear to be working. And it works in all lower MacOS versions.
We are currently obtaining it through AppleScript
try
set ssid to do shell script "system_profiler SPAirPortDataType | awk '/Current Network Information:/ {getline; sub(/^ +/, ""); sub(/:$/, ""); print}'"
if ssid is equal to "" then
return "Not connected to any Wi-Fi network."
else
return ssid
end if
on error errMsg
return "Error: " & errMsg
end try
Topic:
Safari & Web
SubTopic:
General
I'm developing an application that makes use of a WebView. When resuming the app I occasionally run into an issue where the application just shows as a blank page. In the Console.app I see a stack trace, however the details are hidden (see below).
The stack trace is thrown from JavaScriptCore.
default 13:37:07.029261+0200 outlinerrs_dioxus 1 0x1b80cd678 <private>
default 13:37:07.029360+0200 outlinerrs_dioxus 2 0x1b7d50e30 <private>
default 13:37:07.029369+0200 outlinerrs_dioxus 3 0x1047ec800 <private>
default 13:37:07.029539+0200 outlinerrs_dioxus 4 0x1b7d37924 <private>
default 13:37:07.029548+0200 outlinerrs_dioxus 5 0x1b8102a78 <private>
default 13:37:07.029789+0200 outlinerrs_dioxus 6 0x1b8100cb8 <private>
default 13:37:07.029834+0200 outlinerrs_dioxus 7 0x1b7ba7b0c <private>
default 13:37:07.029851+0200 outlinerrs_dioxus 8 0x1b879a520 <private>
default 13:37:07.029870+0200 outlinerrs_dioxus 9 0x1b817f204 <private>
default 13:37:07.030159+0200 outlinerrs_dioxus 10 0x1b76bfce8 <private>
default 13:37:07.030186+0200 outlinerrs_dioxus 11 0x1b76ad838 <private>
default 13:37:07.030245+0200 outlinerrs_dioxus 12 0x1b76bd76c <private>
default 13:37:07.030324+0200 outlinerrs_dioxus 13 0x1b22c827c <private>
default 13:37:07.030424+0200 outlinerrs_dioxus 14 0x1b22c8034 <private>
default 13:37:07.030461+0200 outlinerrs_dioxus 15 0x19d6df230 <private>
default 13:37:07.030514+0200 outlinerrs_dioxus 16 0x19d6df1a4 <private>
default 13:37:07.030584+0200 outlinerrs_dioxus 17 0x19d6bcc6c <private>
default 13:37:07.030592+0200 outlinerrs_dioxus 18 0x19d6928b0 <private>
default 13:37:07.030601+0200 outlinerrs_dioxus 19 0x19d691c44 <private>
default 13:37:07.030607+0200 outlinerrs_dioxus 20 0x23ca6e498 GSEventRunModal
default 13:37:07.030675+0200 outlinerrs_dioxus 21 0x1a300cddc <private>
default 13:37:07.031049+0200 outlinerrs_dioxus 22 0x1a2fb1b0c UIApplicationMain
default 13:37:07.031064+0200 outlinerrs_dioxus 23 0x104a76278 <private>
default 13:37:07.031070+0200 outlinerrs_dioxus 24 0x1047a0064 <private>
default 13:37:07.031254+0200 outlinerrs_dioxus 25 0x104781efc <private>
default 13:37:07.031343+0200 outlinerrs_dioxus 26 0x1047493e0 <private>
default 13:37:07.031352+0200 outlinerrs_dioxus 27 0x10477e1c8 <private>
default 13:37:07.031358+0200 outlinerrs_dioxus 28 0x1047a0184 <private>
default 13:37:07.031373+0200 outlinerrs_dioxus 29 0x1047a033c <private>
default 13:37:07.031409+0200 outlinerrs_dioxus 30 0x104733724 <private>
default 13:37:07.031451+0200 outlinerrs_dioxus 31 0x104464e98 <private>
I tried to create com.apple.WebKit.plist in /Library/Preferences/Logging/Subsystems with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DEFAULT-OPTIONS</key>
<dict>
<key>Enable-Private-Data</key>
<true/>
</dict>
</dict>
</plist>
Does anyone know how to reveal the hidden logs?
"The Safari web extension packager enables you to package and distribute your Safari extensions using App Store Connect from any web browser, without requiring a Mac or access to Xcode."
I upload the unzipped folder I'd test in Chrome://extensions to the Safari web extension packager in App store connect.
I get error:
Embedded binary's bundle identifier is not prefixed with the parent app's bundle identifier.
The only solution i've seen to this error involves xcode/a mac, being without which doesn't help
This is a really strange issue on iOS Safari. Under certain conditions a basic input element will not be focusable or show the on screen keyboard. I can reproduce the issue with a very simple HTML file by dynamically adding an anchor element with an href during a touch event. If you add a different element or an anchor without an href, there is no issue. Similarly, if you apply the same listener to a click event there is no issue.
Reproducible in iOS Simulator 17.2 and 18.1
This HTML/JS showcases the problem:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>InputIssue</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<div id="parent">
<input type="text" name="test" />
<div id="child"></div>
</div>
<script>
document.addEventListener("touchstart", () => {
const child = document.getElementById("child");
if (!child) return;
while (child.firstChild) {
child.removeChild(child.firstChild);
}
const link = document.createElement("a");
link.href = "https://test.com";
link.textContent = "test";
child.appendChild(link);
});
</script>
</body>
</html>
Topic:
Safari & Web
SubTopic:
General
After reading several posts I see that I need to add the "com.apple.developer.web-browser.public-key-credential" capability to my macOS app in order to get it to work.
So my noob question is where do I request this capability? Can I as a developer request it or does the Account owner need to request it?
Once approved, how do I add it to my app's capabilities?
Thanks for your patience
The issue of fixed elements with
{ bottom: 0 }
moving up when scrolling still persists.
It seems to be a general issue with the IOS 26 release.
It affects other browser too. I tested on browsers such as Safari, Chrome, Firefox, Edge and Bravo.
With the exception of Edge, all the others display the behavior.
Device: iPhone 15 Pro
IOS Version: 26.0.1
We’ve noticed that the ApplePaySession.applePayCapabilities() check has stopped working correctly in Safari over the past couple of days.
Behavior observed:
1.) In Safari Private Window, paymentCredentialStatus behaves as expected and case 1 is triggered.
2.) In a normal Safari window, it always triggers case 3 (paymentCredentialsUnavailable), even when the user has active cards provisioned in Wallet.
We tested across multiple devices, and the behavior is consistent.
if (window.ApplePaySession) {
var merchantIdentifier = 'YOUR MERCHANT IDENTIFIER';
var promise = ApplePaySession.applePayCapabilities(merchantIdentifier);
promise.then(function(capabilities) {
switch (capabilities.paymentCredentialStatus) {
case "paymentCredentialsAvailable":
// Show Apple Pay button as primary option
case "paymentCredentialStatusUnknown":
// Offer Apple Pay
case "paymentCredentialsUnavailable":
// Consider showing Apple Pay button
case "applePayUnsupported":
// Don’t show Apple Pay button
}
})
}
This used to work fine until a few days ago, but now the capability check in non-private Safari windows always indicates unavailable, even with valid active cards.
Has anyone else faced this issue recently? Could this be a Safari regression or a change on Apple’s side?
Thanks in advance!
The app I work on uses WKWebView to render customer data. In iPadOS 26, we observe that there is a delay when resizing the window (and thus the web view) before the content is re-rendered. The same behavior is visible in Safari.
For demonstration purposes, consider this test page: https://phet-dev.colorado.edu/html/build-an-atom/0.0.0-3/simple-text-only-test-page.html
Initially, the window is small:
Then when the window is expanded, the content scales up temporarily:
It eventually re-renders to the correct size, but then if you make the window small again, you get (temporarily):
Is there anyway around this behavior? We would love to have the content reflow interactively.
I'm a web developer of WebRTC based web app for video and audio calls. After updating to iOS 26.1 beta I noticed, that my app can't use microphone anymore.
When I'm calling to getUserMedia with audio set to true, Safari returns error "No AVAudioSessionCaptureDevice device".
Other WebRTC demo apps also can't access microphone on this firmware.
And maybe it's connected somehow, but safari can't detect connected AirPods Pro 2 as an input device.
So, this bug brakes any WebRTC app, that uses microphones.
We are seeing an issue in Safari on iOS 26 where the a automatic unfocus of on select box dismisses the second one.
<select name="choice1" onblur="console.log('onblur1');" onfocus="console.log('onfocus1');">
<option value="first">First Value</option>
<option value="second" selected>Second Value</option>
<option value="third">Third Value</option>
</select>
<select name="choice2" onblur="console.log('onblur2');" onfocus="console.log('onfocus2')">
<option value="first">First Value</option>
<option value="second" selected>Second Value</option>
<option value="third">Third Value</option>
</select>
select something in choice1.
quickly tap choice2 before onblur1 is logged.
At the timing of onblur1 the selection menu for choice2 is dismissed.
Anyone know how to fix this behavior?
I'm looking for answer or documentation on gatekeeper and launching a MacOS app via a url scheme/custom protocol.
Our application is delivered via a zip file downloaded from the web. We utilize a url scheme. The act of extracting the app from the zip registers the url scheme with the OS.
From previous research/testing we found we had to break the gatekeeper lock (have the user move the app from the downloaded location) to ensure that the url is honored on first launch of the application. To ensure user compliance, we added a check to make sure that the lock has been removed by looking at the quarantine attribute.
This flow is not ideal. I am looking for alternatives and was previously under the impression that if we were to move to a DMG then that would provide the user a better user experience for moving it. However, now that I am getting
around to looking into it, I am seeing some implied statements that this is not the case and that the quarantine bit will just be moved from the DMG to the app.
Questions:
Does a DMG allow the app to be launched via custom protocol without prior launch or movement?
With a notarized app, will the custom protocol work on a subsequent launch, even without prior movement?
Topic:
Safari & Web
SubTopic:
General
Command: com.apple.WebKit.Networking
Path: /private/preboot/Cryptexes/OS/System/Library/ExtensionKit/Extensions/NetworkingExtension.appex/com.apple.WebKit.Networking
Identifier: com.apple.WebKit.Networking
Version: ??? (8621.3.11.10.3)
Resource Coalition: "com.apple.mobilesafari"(1005)
Architecture: arm64e
Parent: launchd [1]
PID: 1708
Please!
is there an app or anything I can do
ive posted multiple times.
Ive researched all that I can
even with screen time on and web limits it still lets u swipe to delete history! Yes it’s grayed out but u can still swipe and delete it!!
I have observed Safari App starts crashing when running with my safari extension.
Our Safari extension polls the host app every 60s. The extension receives and completes requests in
func beginRequest(with context: NSExtensionContext)
(we always call context.completeRequest(...)). The crash is intermittent: beginRequest itself does not throw.
Looking for guidance about likely causes. I am attaching the snippet from crash report.
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_CRASH (SIGKILL)
Exception Codes: 0x0000000000000000, 0x0000000000000000
Termination Reason: Namespace RUNNINGBOARD, Code 3490524077
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_kernel.dylib 0x1856f5c34 mach_msg2_trap + 8
1 libsystem_kernel.dylib 0x1857083a0 mach_msg2_internal + 76
2 libsystem_kernel.dylib 0x1856fe764 mach_msg_overwrite + 484
3 libsystem_kernel.dylib 0x1856f5fa8 mach_msg + 24
4 CoreFoundation 0x185822cbc __CFRunLoopServiceMachPort + 160
5 CoreFoundation 0x1858215d8 __CFRunLoopRun + 1208
6 CoreFoundation 0x185820a98 CFRunLoopRunSpecific + 572
7 HIToolbox 0x1912c327c RunCurrentEventLoopInMode + 324
8 HIToolbox 0x1912c64e8 ReceiveNextEventCommon + 676
9 HIToolbox 0x191451484 _BlockUntilNextEventMatchingListInModeWithFilter + 76
10 AppKit 0x189745a34 _DPSNextEvent + 684
11 AppKit 0x18a0e4940 -[NSApplication(NSEventRouting) _nextEventMatchingEventMask:untilDate:inMode:dequeue:] + 688
12 Safari 0x1b801cce4 -[BrowserApplication nextEventMatchingMask:untilDate:inMode:dequeue:] + 228
13 AppKit 0x189738be4 -[NSApplication run] + 480
14 AppKit 0x18970f2dc NSApplicationMain + 880
15 Safari 0x1b83dd0b0 SafariMain + 468
16 dyld 0x185396b98 start + 6076
Hi! I'm trying to implement ASWebAuthenticationSession to log in to my app via the web app backend. However, I'm a bit confused about the cookies that this has access to. When I set prefersEphemeralWebBrowserSession=false it does not seem to use the cookies from Safari. Or at least, I'm logged into my web app in Safari, but when I use ASWebAuthenticationSession I still have to log in again. Does it not share session cookies with Safari?
I did notice that if I don't use an ephemeral session, once I log out and try to log back in my app does automatically log me in but that's actually unhelpful in my opinion because now I have no way to clear that session because it only lives in the ASWebAuthenticationSession context. If that's the case I may as well use the ephemeral session then because it seems to have only drawbacks.
Hi Developers,
I am working on a small project and I noticed that my website header looks different in Safari on macOS compared to Windows browsers like Chrome and Edge.
In Safari, the header text and spacing look slightly shifted (screenshot attached).
On Windows browsers, everything looks perfectly aligned.
Here is my live project for reference: https://gratuitycalculatorae.com/
Screenshot from Safari (macOS):
Is this related to Safari-specific CSS rendering?
Should I use -webkit- specific fixes or is there a better cross-browser solution?
Any guidance or best practices would be really helpful. Thanks