Post

Replies

Boosts

Views

Activity

Reply to declarativeNetRequest - redirect action type not supported
There are other ways to accomplish a redirect within the extension, but none will likely have as good UX by doing it the way you described. Building out the declarativeNetRequest api in Safari would be really beneficial to developers and I am sure filing feedback would help get that point across. browser.webRequest could be used, however it is only supported for persistent background pages, which is incompatible with iOS and manifest v3 project. - https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/webRequest You could use a content script to redirect, however depending on the amount of logic in your app, this could be less optimal UX. You could use browser.tabs.update, but again, less than optimal user experience: https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/update Hopefully Apple will build out the rest of this API for Safari. Here's a somewhat related thread: https://developer.apple.com/forums/thread/682541
Topic: App & System Services SubTopic: General Tags:
Feb ’22
Reply to SFSafariApplication.openWindow(with:) not working
Is your extension Web Extension format or Safari App Extension? In the case of Web Extensions, ensure you have proper permissions in your manifest. https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/create https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/windows (window api docs if you really want to open a new window) Create a new tab with Web Extension: browser.tabs.create({url: "https://www.apple.com"}, response => { // ... }); Create new tab with Safari App Extensions: func openTab() { guard let url = URL(string: "https://apple.com/") else { return } SFSafariApplication.getActiveWindow { (window) in window?.openTab(with: url, makeActiveIfPossible: true) { (tab) in // ... } } }
Topic: Safari & Web SubTopic: General Tags:
Feb ’22
Reply to Download attribute not working in web extension popup
Are there any updates to this? This also affects bundled html extension pages within a web extension. Using the Safari App Extension API (as compared to the Web Extension API), it is possible to download arbitrary files using the method above, but with the Web Extension API, the download attribute is not respect and a new tab opens with the download content.
Topic: App & System Services SubTopic: General Tags:
May ’22
Reply to Adoption of New MV3 Standards for Browser Extensions
Good questions. Just a note: header-based modifications in the coming days Even with mv2, Safari lacks some of the implementation for modifying headers compared to all other modern browsers. You can check out the support on the MDN docs for webRequest which I believe is deprecated in favor of declarativeNetRequest. I've used declarativeNetRequest with both mv2 and mv3 Safari extensions and was disappointed to see that header modification still lacks with that API implementation. action.type: "modifyHeaders" is not supported as of writing this comment :/ I'm hopeful they will reverse their current stance on header modifications.
Topic: Safari & Web SubTopic: General Tags:
Jul ’22