Post

Replies

Boosts

Views

Activity

[iOS 18] Is there an SF Symbol of the new icon in Safari's address bar?
The following icon has been introduced in Safari's address bar for iOS 18: I’d like to use it in my app to guide users on how to enable my Safari extension, but I couldn’t find it in SF Symbols beta 6.0 (99). Is this because it’s still in beta and will be available for third-party use later, or is it a private icon that only Apple can use? I hope I just overlooked something.
1
0
471
Sep ’24
Safari DNR Redirect Issue When Using Address Bar for Default Search Engine Queries
I’ve noticed that redirecting from one web page to another using DNR (Declarative Net Request) no longer works if: The source page is a search results page of the default search engine, and The user searches for a keyword from Safari’s address bar. Has this functionality been degraded, or is it an intentional restriction? I'd like a response from Apple. Steps to Reproduce Create a Safari extension that adds the following rule using browser.declarativeNetRequest.updateSessionRules() in background.js: { id: 37457985, priority: 1, action: { type: "redirect", redirect: { regexSubstitution: "https://search.brave.com/search?q=\\1" }, }, condition: { regexFilter: "https://duckduckgo.com/\\?(?:.*&)?q=([^&]*).*", resourceTypes: ["main_frame"] } } Enable the extension in Safari. Set Safari’s default search engine to DuckDuckGo. Type "hello" in the address bar to search for it. Expected: Search results for "hello" appear in Brave Search. Actual: Safari navigates to neither DuckDuckGo nor Brave Search. For further reference, please see: Sample Xcode project: GitHub link Demo video: GitHub link Environment I’ve confirmed this issue on the following environments: Safari Technology Preview 202 (macOS Sonoma 14.6.1 (23G93)) iOS 18 RC (22A3354) This issue does not occur in the latest release version of Safari 17.6 (19618.3.11.11.5) on macOS, so I believe it started with the current development version of Safari. Context My Safari extension, Redirect Web for Safari, uses DNR to redirect one web page to another. While the extension is not specifically designed to change the default search engine, some users use it to set their preferred search engine. Unfortunately, this issue will break their use case. Additional Information This issue only occurs when searching from the address bar. It does not happen when searching directly from https://duckduckgo.com. I haven’t submitted this issue via Feedback Assistant because I’m unsure if it’s a bug or intentional behavior. I’d like to confirm if this is by design first.
2
0
547
Sep ’24
Navigation-related listeners are not called after opening an embedded Web page
I made a Safari Web extension that's supposed to work like this: WHEN: Safari is opening http://example.com/ THEN: The extension opens a page embedded in the extension instead. This is the implementation of background.js: browser.tabs.onUpdated.addListener(async function (tabId) { const tab = await browser.tabs.get(tabId); if (tab.url == "http://example.com/") { const destination = browser.runtime.getURL("embedded-page.html"); browser.tabs.update(tabId, { url: destination }); } }, null); This is the source project: https://www.icloud.com/iclouddrive/042qIjivEoJ0V3qIcLGcytAPA When opening http://www.example.com/ for the first time, it successfully navigates to the embedded page. However, once that navigation is done, the extension no longer works that way unless I re-enable the extension. It's like the listeners are removed by that navigation. This is the video of this issue: https://www.icloud.com/iclouddrive/0f9Yl1jC9eQ8OmgH8vAtEA6Pw Can you replicate this on your Mac? And do you know what's the cause? This happens for a listener of browser.webNavigation.onBeforeNavigate too. Maybe more. On the other hand, when I set a normal page such as https://www.apple.com/ to destination, It always works fine for me. So I'm wondering if this issue is related to the embedded page. FYI, I already reported this issue as FB9967637 on 27th March but no reply from Apple as of now. My environment macOS Monterey 12.3.1 (21E258) Safari 15.4
2
0
1.3k
May ’22
SFSafariApplication.dispatchMessage() switches Safari to foreground?
I'm developing a Safari web extension for macOS that calls SFSafariApplication.dispatchMessage() (Swift) to communicate with background.js and the popup. However, I noticed that the method forcefully switches Safari to foreground. It seems it happens after calling browser.runtime.sendNativeMessage(''); in JavaScript. Is there a way to avoid that behavior? Or perhaps I'm misunderstanding something? This is a sample project and its video (Safari is switched to foreground every 3 seconds.): Sample project: https://www.dropbox.com/s/vs7h128ef1ji34q/ForcefulForegroundIssuePlayground.zip?dl=0 Video: https://www.dropbox.com/s/7pjbh1rihnh068l/Screen%20Recording%202021-12-23%20at%205.42.44%20pm.mov?dl=0 By the way, I already submitted a feedback for this as FB9804951 about 2 weeks ago but no response from Apple so far and I don't know if Apple will take any action for that or not even after the new year so I decided to ask here as well.
2
0
957
Dec ’21
Can a Safari extension detect a page navigation error?
When the user tries to open a non-existing URL such as https://dsjiksfdakjf.com, Safari shows a built-in error page that displays texts like this: Safari Can’t Find the Server Safari can’t open the page “https://dsjiksfdakjf.com” because Safari can’t find the server “dsjiksfdakjf.com”. Can a Safari extension detect when this happen? Background of question I'd like to allow users to redirect from a broken or censored (HTTP 451) URL to another URL as a fallback, so that my users won't loose what they can still do other than just closing the tab. I've been looking for the solution but so far, no luck. I couldn't find out such functionalities from SFSafariExtensionHandler, SFSafariPage, etc. JavaScript files of extensions are not loaded for that error page either. I even wonder if it actually can't detect and what I can do for now is just to submit the feedback to Apple...
1
0
1.1k
Oct ’21
NSWindow presented on Safari extension (.appex) is not resizable?
I'm trying to present a resizable NSWindow defined like this: let window = NSWindow() window.contentViewController = NSHostingController( rootView: Rectangle().frame(minWidth: 100, minHeight: 100)) window.styleMask.insert([.closable, .resizable]) Generally, I can resize this window but somehow I can NOT when it's presented from Safari app extension (.appex). Did I miss something? Does anyone know what's happening?
1
0
959
Aug ’21
Drag & Drop with NSTableViewDiffableDataSource
I'm now trying to add Drag & Drop feature to my NSTableView which uses NSTableViewDiffableDataSource for its data source. However, I can't implement the methods for Drag & Drop like tableView(:, acceptDrop:, row:, dropOperation:). My code looks like this: swift class MyViewController: NSViewController { private let tableView: NSTableView = {...}() private lazy var dataSource = MyDataSource(tableView: tableView) ... } class MyDataSource: NSTableViewDiffableDataSourceSection, Model { ...     override func tableView(_ tableView: NSTableView, draggingSession session: NSDraggingSession, willBeginAt screenPoint: NSPoint, forRowIndexes rowIndexes: IndexSet) { ...     } } Since NSTableViewDiffableDataSource implements NSTableViewDataSource protocol which provides Drag & Drop methods, I thought the above overriding method would work but I got this error. Method does not override any method from its superclass What happened? And if this is expected, how can I implement Drag & Drop with NSTableViewDiffableDataSource?
3
1
2k
Feb ’21