Safari is the web browser developed by Apple and built into all Apple devices.

Posts under Safari tag

200 Posts
Sort by:

Post

Replies

Boosts

Views

Activity

how can i get camera access in ios12 application embedded html
i can sure the app already hava the camera access, but in the embedded html, i still cannot open the camera. And this HTML page is work at Safari, but cant work on app when the page is embedded in app. there is the error message: DOMException: undefine is not an object (evaluating 'navigator.mediaDevices.getUserMedia') and i also try to use 'navigator.getUserMedia' and 'navigator.mediaDevices.enumerateDevices()', this all dont work.
0
0
27
5h
Web Extensions's background page is missing in the Develop -> Web Extension Background Content menu in the latest Safari Technology Preview
Hello! I was wondering if any other developers are experiencing issues with accessing the web extension background script console, sources, etc. on the latest Safari Technology preview or macOS Sequoia betas. We have an extension which has a persistent background script. In the latest public release of Safari version 17.5 (19618.2.12.11.6) on macOS Sonoma, everything works as expected. When I enable developer mode in Safari, it shows an additional "Develop" menu and when I select "Web Extension Background Content" in the dropdown, it shows a list of background pages for all installed extensions. Attaching a screenshot for reference. However, if I install the latest Safari Technology Preview 197 on macOS Sonoma or just test with the Safari version that comes with MacOS Sequoia beta 1 or beta 2, the "Web Extension Background Content" dropdown menu does not list any background pages. Attaching a screenshot for reference. We started discussing the issue with Apple during the latest WWDC. If anyone at Apple sees this post, I opened FB13834388 to track this issue. However according to Apple, they cannot reproduce the issue exactly as I see it on all macOS machines around me including clean virtual machines, real hardware (MacBook Pro M1 Max, MacBook Air M2, MacBook Pro Intel based). The "Web Extension Background Content" menu looks as expected on their end which is very confusing to me... I have a reason to believe that new Safari's developer tools are simply broken in the latest release. I base that statement on the fact that I cannot access it in case of our own Safari extension, Apple's sample "Sea Creator" extension and a few random extensions that I got from the App Store. I was wondering if anyone else can observe the same behavior or all machines around me are haunted :) Please share if you have similar issues with Safari Technology Preview 197 or Safari on the latest macOS Sequoia beta. Any feedback is important to us. If it's a widespread issue, then Apple should prioritize is accordingly. If the issue is somehow specific to our testing, we will fix it on our side. But any test results at this point are bringing more clarity to the situation and are highly appreciated.
2
0
130
1d
Safari Tabs in shared Tabgroups multiplied
As I wanted to transfer my existing tabgoups from my iPhone/Mac to my new iPad (strange that it’s not working on its own) I shared the tabgroup as a message and opened it on my iPad. From that moment on I had shared tabgroups with a blue dot behind the individual tabs in the tabgroups and a menu bar on the top of each tab where I was able to discontinue the sharing. After a short while a noticed all tabs in the tab groups consisting of more than 400 tabs multiplied 5x. I am using iOS 18 beta on the iPad and iOS 17.6 on my iPhone. My MacBook Pro from 2016 wasn’t used during the sharing process, but after the Desaster started I disabled tab groups on safari settings in hopes of conserving the tab group without the multiplies on my MacBook. On my MacBook i opened safari and clicked on the shared Tabgroups whereat a warning poped up that MacOsx 13 or later is required for using shared tabgroups nonetheless all tabs are multiplied… please help 😀
0
0
104
2d
Safari Extension Service Worker Permanently Killed on iOS 17.4.x-17.6
Since probably the late iOS 17.4.x, 17.5.1 and still now in 17.6 beta our extension has been experiencing issues with the accompanying background script or service worker being permanently killed with no warning after about 30-45 seconds after initial installation (installation, not page load!). In all other browsers (including Safari on MacOS) unloading the service worker is part of the normal lifecycle to save memory and CPU if it is idle. In our extension the service worker is used only during the first 5-10 seconds of every page visit, so we are used to seeing it unload after that and consider this a good thing. However, normally, the service worker is able to wake back up when needed - which is no longer the case in iOS. Once dead, nothing a normal user would do can wake the service worker back up: No events like webNavigation or similar will trigger anymore Any attempt to call sendMessage to it from a content-script also does not wake up the service worker and instead returns undefined to the content script immediately Closing and opening Safari does not start it again The only two things that will give the service worker another 30-40 seconds of life is a reboot of the device or disabling and then re-enabling the extension. During those few second the extension is working perfectly. There are no errors or indications in the logs of what is going on and the extension works just fine in Chrome, Firefox, Edge as well as Safari on MacOS and Safari in the Mobile simulator. Only actual iOS devices fail. It seems like a temporary workaround is to change the manifest to not load the service worker as a service worker by changing "background": { "service_worker": "service.js" } to "background": { "scripts": ["service.js"], "persistent": false } With this change (courtesy of https://forums.developer.apple.com/forums/thread/721222) the service worker is still unloaded but correctly starts up again when needed. Having to make this change does not seem to be consistent with manifest v3 specs though (see this part in Chrome’s migration guide as an example: https://developer.chrome.com/docs/extensions/develop/migrate/to-service-workers#update-bg-field). According to the release notes of 17.6 beta this bug was supposedly fixed: “Fixed an issue where Safari Web Extension background pages would stop responding after about 30 seconds. (127681420)” However, this bug is not fixed - or at least not entirely fixed. It seems to work better for super simple tests doing nothing but pinging the service worker from the content script, but for the full blown extension there is no difference at all between 17.5.1 and 17.6. Has there been a change in policy about service workers and background scripts for Safari in iOS? Are anyone else seeing this issue? Also seemingly related: https://forums.developer.apple.com/forums/thread/756309 https://forums.developer.apple.com/forums/thread/750330 https://developer.apple.com/forums/thread/757926 https://forums.developer.apple.com/forums/thread/735307
1
1
171
4d
"No current extension context; trying most recent context" errors in Safari App Extensions
Hello, I've encoutered an issue with Safari App Extensions. My extension prints lots of suspect error logs in the Xcode console and inside Console.app. This happens basically whenever I make any interaction with the App Extension or with Safari. The most common and predictable error log I get is: No current extension context; trying most recent context (Subsystem: com.apple.SafariServices) However, I also sometimes get the following error messages, albeit less frequently, which may be related: No extension context for best match No extension context for remote object Error connecting back to host for remote object: NSCocoaErrorDomain, code: 4099 No known extension contexts for profile 00000000-0000-0000-0000-000000000000 Most recent extension context B7223E12-B563-45E0-97F8-50500BC6B994 does not have connection back to host; trying best match context I haven't been able to find anything about these error logs in Apple documentation or on the Internet, so I did a bit of empirical investigation. I reproduced the bug in the following basic scenario: I've created a new Safari App Extension project in Xcode by going to File > New > Project > Safari Extension App. I've selected "Safari App extension" for the type and "Swift" for the language. The project comes by default with a "SafariExtensionHandler.swift" file, which includes the following code: override func validateToolbarItem(in window: SFSafariWindow, validationHandler: @escaping ((Bool, String) -> Void)) { validationHandler(true, "") } No issues so far. If I add the following call: override func validateToolbarItem(in window: SFSafariWindow, validationHandler: @escaping ((Bool, String) -> Void)) { validationHandler(true, "") SFSafariApplication.getActiveWindow { window in // code } } There are still no error messages logged in the Console. However, if I do this instead: override func validateToolbarItem(in window: SFSafariWindow, validationHandler: @escaping ((Bool, String) -> Void)) { validationHandler(true, "") DispatchQueue.main.async { SFSafariApplication.getActiveWindow { window in // code } } } Then my Xcode console starts being spammed with "No current extension context; trying most recent context" error logs. With some more testing, it seems that the most common/predictable situation that causes the error log seems to be when calling any Safari API (e.g. SFSafariApplication.getActiveWindow{} or even SFSafariApplication.setToolbarItemsNeedUpdate()) outside of a direct method call provided by the Safari App Extension API. So making API calls directly from inside validateToolbarItem(in:, validationHandler:) or messageReceived(withName:from:userInfo:) calls is fine, but anything else causes "No extension context" logs. The bug even reproduces if you make a Safari API call directly inside of an @IBAction method call caused by a button click inside the Safari popover of the Safari App Extension. With this being the case, it seems to be impossible to make clean Safari API calls in an asynchronous or proactive way, which is problematic for our app extension use case and which seems to defeat the purpose of some of the API calls like SFSafariApplication.setToolbarItemsNeedUpdate(). Also, this seems to be a new issue. I've tested these scenarios on various macOS versions that I had on hand (specifically, on macOS 10.15 Catalina, macOS 13 Ventura and macOS 14 Sonoma) and the bug seems to reproduce only on macOS 14 Sonoma. The Safari App Extension behaves as expected on previous macOS versions, with no suspect error logs. Does anyone know what this issue is about?
3
0
172
1d
Safari iOS extension issues. Background script stops working
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
3
2
237
1w
Safari Content Blocker extension
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?
0
0
222
1w
Import a debit/credit card directly from a web app into the iPhone's wallet
Hi, I know it's currently possible to import a virtual debit/credit card from a mobile app into the IOS Wallet using PassKit from the Apple SDK, but I haven't seen any documentation to do it directly from a web app, could you please tell me if it is possible to do it directly from a web app without using a mobile app? And if so, point me to some documentation? Thanks in advance
1
1
221
2w
[WebXR] Support for AR module in VisionOS 2.x
Thank you again for pushing the web forward in VisionOS 2, super exciting! The latest WWDC24 video touched on VR experiences for VisionOS2.0 using WebXR, however there was no mention of passthrough AR experiences. Samples such as this one are not supported: https://immersive-web.github.io/webxr-samples/immersive-ar-session.html In Settings > Safari, there is a feature flag for the AR WebXR module, but enabling it did not seem to change anything. Is this the expected behavior at this time? Any developer preview(s) we could try?
2
1
312
2w
iOS 17.5.1 safari extension - background scripts not working properly
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.
1
5
400
1w
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
278
3w
Safari Web Extension background script becomes unresponsive after 30 seconds
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.
4
4
700
1w
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
580
May ’24
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
629
May ’24
Fairplay on M2/M3 MacBook's not honouring lease duration in license
Doing some testing around player behaviour when a license expires in Safari on MacOS. I had the following outcomes: On Safari 17.4.1 on an intel based Mac running Ventura, playback stopped when the license expired. On Safari 17.4.1 on an M3 running Sonoma, playback stalled briefly, and then continued to play unlimited. On Safari 16.5.2 on an M2 running Ventura, playback stalled briefly, and then continued to play unlimited. When playback stalled briefly, was at the time the license expired. I parsed the license and everything is set correctly for a lease license type: { "version" : 1, "payloadLength" : 1072, "iv" : "0H9NCXLQeh1ziYpmJXsnwQ==", "assetId" : "䙁㉌䉃\u0000\u0000\u0000", "hdcp" : "TYPE_0_REQUIRED", "contentKeyDuration" : { "leaseDurationSeconds" : 300, "rentalDurationSeconds" : 0, "persistenceAllowed" : false }, "keyType" : "Lease" } I cannot find any information relating to this behaviour. Per the docs for FPS, a lease license type: If the content key is not renewed, the Apple device stops the playback when the lease expires. Which is what is observed on the intel based macbook.
0
0
262
May ’24
Inconsistent Caching Behavior for MP3 Files in Safari Despite Proper Cache-Control Headers
I'm working on an Angular application that retrieves static data (JSON, MP3, and images) from a backend server, with a cache control response header set to Cache-Control: public, max-age=2592000. I expect these files to be served from either disk or memory cache after the initial request. However, in Safari, the browser sometimes fetches the data from the cache and other times makes a network call. This inconsistent behavior is particularly noticeable with MP3 files, whereas JSON and image files are consistently served from the cache as expected. I've tested this on multiple Safari versions and observed the same issue: Version 17.2 (19617.1.17.11.9) Version 17.1 (19616.2.9.11.7) Version 17.3 (19617.2.4.11.8) I confirmed that the "Disable Cache" option is not enabled in the developer tools, so the MP3 files should be cached. This functionality works correctly in Chrome and Firefox without any issues.
0
0
244
May ’24
iOS17.4.1 canvasをクリアしても特定の操作で描画が復活します
【現象】 Safariブラウザでcanvasに対して任意の描画をした後、clearRect()を実行します。 その後、canvasの親divに対して visibility: hidden を設定すると、消したはずの描画が復活します。 但し、親divは正常に visibility: hidden が働いているので描画されなくなります。 また、この現象はブラウザの拡大率が影響をしているようです。 少なくとも後述のリスト内のMacbookAirでは、拡大率が100%の場合にのみ発生しています。 この現象は過去のバージョンでは起きてないようです。 このバグを修正する予定はありますか? 【機種】 機種は以下のリストを確認してください。 Model OS&Version Y/N version MacbookAir M2 2022 macOS Sonoma 14.4.1 y 17.4.1 Mac Studio 2022 Apple M1 Max macOS Monterey 12.5 n 16.0 MacBook Air M1 2020 macOS Sonoma 14.3.1 n 17.3.1 iPadPro gen6 iPadOS 17.4.1 y - iPad gen10 iPadOS 17.4.1 n - 【デモ】 現象を確認するためのデモは以下のHTMLファイルを保存してブラウザで開いてください。 再現手順はボタンを draw -> clear -> hide の順番に押してください。 黄色の親divが非表示になるのに対し、canvasからclearしたはずの黒い四角が表示されます。 <html> <body onload="onLoad()"> <div id="parent" style="background-color: yellow;"> <canvas id="canvas"></canvas> </div> <button onclick="drawCanvas()">draw</button> <button onclick="clearCanvas()">clear</button> <button onclick="showCanvas()">show</button> <button onclick="hideCanvas()">hide</button> <script> let parent let canvas let context2d function onLoad() { parent = document.getElementById("parent") canvas = document.getElementById("canvas") context2d = canvas.getContext('2d') } function drawCanvas() { context2d.fillRect(0, 0, 100, 100) } function clearCanvas() { context2d.clearRect(0, 0, canvas.width, canvas.height) } function showCanvas() { parent.style.visibility = "visible" } function hideCanvas() { parent.style.visibility = "hidden" } </script> </body> </html>
1
0
294
May ’24