Posts

Post not yet marked as solved
12 Replies
4.6k Views
All of my third party extensions have blue icons now, in Safari 14.0. It looks pretty awful. Is there a way to keep the monochrome colors or a way for us, as developers, to provide a different kind of icon to sustain the monochrome colors for our extensions? I am assuming the blue color denotes something, like the extension being "active". I wasn't able to find documentation on this change nor any related api doc.
Posted
by jw732.
Last updated
.
Post not yet marked as solved
1 Replies
1.3k Views
Clicking an anchor tag <a> using a download attribute and data uri as the href doesn't trigger a download in a webextension bundled html page. Rather it opens a new tab and navigates to the data uri. This is the not the same behaviour users experience on the web nor the same behaviour as a Safari App Extension bundled html page. Is this intentional? Is this a shortcoming of the WebExtension API? Is there any way around this? Any guidance would be appreciated.
Posted
by jw732.
Last updated
.
Post not yet marked as solved
1 Replies
917 Views
Currently Safari does not support modifyHeaders as an action.type when using the declarativeNetRequest API. Does the Safari team plan on building out this action.type for the API? Safari seems to be the only major browser that lacks support for header manipulation, even with the mv2 APIs (ie. webRequestBlocking). Is this purposefully being omitted? If so, why?
Posted
by jw732.
Last updated
.
Post marked as solved
1 Replies
799 Views
Adding the webRequest permission to my manifest file does not give me access to the webRequest WebExtension api in my background page. From looking at the docs, I see that webRequestBlocking is not supported, but no mention of webRequest not being supported. I am on macOS 12.1 and Safari 15.2. Example: ... "permissions": [ "<all_urls>", "webRequest" ] ...
Posted
by jw732.
Last updated
.
Post not yet marked as solved
5 Replies
2.3k Views
Currently, if a page csp disallows inline scripts, but the content script attempts implant inline scripts (DOM injected scripts) - the code will fail to execute. This is an issue with the current Safari extension model. The effect of this is that content scripts that inject dynamic (user-generated) content can not properly interact with the page context. This is also an issue with other major browsers, however I do not believe Chrome has this restriction. The reason I say "do not believe" is because the documentation indicates that "page csp does not apply to content scripts", but I have not personally tested this. I'd like to know is this restriction will be present with the new Safari WebExtension model, especially considering that webRequestBlocking is not supported (which would be the only workaround I am aware of).
Posted
by jw732.
Last updated
.
Post marked as solved
1 Replies
1.4k Views
I am running a Safari extension on my phone and getting this error when running browser.runtime.sendNativeMessage({...}); I am only getting this error when sending a specific message, other messages return as expected. When I run on the simulator I do not get this error. Does anyone one what Code=3 represents?
Posted
by jw732.
Last updated
.
Post not yet marked as solved
0 Replies
3.3k Views
I am trying to implement Google Analytics with my extension that is built with the Extension Builder. Is there any guides or advice on how to go about implementing this?My extension consists of a global.html and popover.html file only. I tried putting the GA snippet in both and it is seemingly not working. I can see through the console that when the GA snippet is in the popover.html, a network request is being made to the GA server, but it doesn't seem to be tramistting the data. If I run my extension locally (it's using plain web technologies), I can see on my analytics page that it is registering my activity; this doesn't happen whilst using the extension.Any help or advice would be appreciated.
Posted
by jw732.
Last updated
.
Post marked as solved
1 Replies
1.1k Views
How do you add iOS support for an existing Safari WebExtension? I tried running xcrun safari-web-extension-converter --rebuild-project /path/to/project.xcodeproj but that just shows the help text for the safari-web-extension-converter. Is there any documentation that demonstrates a manual way to do this? Specs: Safari 14.1.1 macOS 11.4 Xcode 12.5.1
Posted
by jw732.
Last updated
.
Post not yet marked as solved
0 Replies
954 Views
This also applies to browser.menus.create. Adding a url to documentUrlPatterns that has an explicit pathname, such as /some/page/ does not against document urls that should match. Example 01: browser.contextMenus.create({id: "12354", title: "Test01",documentUrlPatterns:["https://www.linkedin.com/feed/"]}); When using the above code, no context menu item is created for "https://www.linkedin.com/feed/". However, if I drop the trailing slash /, the menu item is created as expected. If the page has no formed pathname, it's simply /, the context menu is created as expected. The following code will work as expected, note the pathname. Example 02: browser.contextMenus.create({id: "12354", title: "Test01",documentUrlPatterns:["https://www.apple.com/"]}); Example 01 works as expected in Firefox, but as mentioned does not work in Safari. Is this purposeful or potentially a bug? Specs: Safari Version 14.1.1 (16611.2.7.1.4) macOS Version 11.4 (20F71)
Posted
by jw732.
Last updated
.
Post not yet marked as solved
2 Replies
1.4k Views
Is there parity between the two APIs? My extension is using the "original" Safari App Extension API (swift). However, I can do things with WebExtensions I can not seem to accomplish with Safari App Extensions. A simple is example is dynamically creating a context menu item (browser.contextMenus.create({...})). There are likely more examples, but that was the first I tried. Is there some undocumented API for Safari App Extensions that allows for everything that WebExtensions are capable of doing?
Posted
by jw732.
Last updated
.
Post marked as solved
3 Replies
890 Views
Almost every single test build I run with my extension, I need to: open extension preferences click the checkbox for my extension double click my apple watch to approve click 'turn on' button after approved To be clear, I am told my extension interferes with clicking - that is why I need to go through two steps to re-allow the extension and I theorize that is also why my extension becomes disabled after every test run. This isn't ideal since I tend to build/test my extension quite a bit as I am developing. This adds a lot of time to that process. Is there anyway, as the developer, to stop getting these prompts and just keep the extension enabled and allowed during development? Thank you.
Posted
by jw732.
Last updated
.
Post not yet marked as solved
0 Replies
644 Views
When my extension loops through all open pages and the page properties, all pages isActive prop returns true. For example: 2 Safari windows open Window 1 has 2 tabs open (apple.com, bing.com) Window 2 has 3 tabs open (google.com, github.com, extension's bundled html) I am in Window 2 and on my extension' bundled html page When I run a function that iterates through the pages and returns the isActive prop - all pages return true, except my bundled html page. (I understand my extension's bundled html page won't return page props, this is not my issue) What exactly does isActive indicate? code (perhaps there is a more terse way to write this): SFSafariApplication.getAllWindows { (windows) in         for window in windows {             window.getAllTabs{ (tabs) in                 for tab in tabs {                     tab.getPagesWithCompletionHandler { (pages) in                         if pages != nil {                             for page in pages! {                                 page.getPropertiesWithCompletionHandler({ props in                                     let isActive = props?.isActive ?? false                                     if !isActive {                                         page.getContainingTab(completionHandler: { tab in                                             tab.close()                                         })                                     }                                 })                             }                         }                     }                 }             }         }     }
Posted
by jw732.
Last updated
.
Post marked as solved
1 Replies
676 Views
Is there any way to determine if a bundled html page is already open within Safari? Iterating through the open tabs and looking at the page properties (url, title, etc...) all return nil for bundled html pages currently open in the browser. When a user clicks the toolbar icon in my extension, I'd like to check if another instance of the extension's bundled html page is already open in a tab, and if so, activate that tab rather than opening another instance.
Posted
by jw732.
Last updated
.
Post marked as solved
3 Replies
1.6k Views
At this past WWDC, @bweinstein said this:"Safari now injects the safari javascript object to any frames loaded with content from your extension, meaning those frames can send message to the Safari App Extension and receive messages from it"Link to video, go to 10:50However, when I successfully load a bundled html file from the contents of my extension, I am not able to communicate with the safari javascript object to send and recieve messages from my Safari App Extension. I am on testing this on Safari 12.1.2. I am attempting to communicate with the safari javascript object as I would from a content script, ex. `safari.extension.dispatchMessage("Hello World!");`Is this a bug, can anyone give me some insight here?
Posted
by jw732.
Last updated
.
Post not yet marked as solved
3 Replies
1.3k Views
Has anyone else experienced this issue?Any popover that contains a WebKit View crashes the extension in Catalina Beta 1-3 and Safari 13. This seems like an upstream bug, so I've filed a bug report in Beta 1, but never got any response from Apple.If anyone has advice on dealing with this, it would be much appreciated. This not only affects existing extensions but any new ones as well.
Posted
by jw732.
Last updated
.