Confusion about Safari Extension vs. Safari App Extension

I'm having trouble finding info on the reasoning, timing, and info on the transition from the old way of creating a Safari Extension to the new Safari App Extensions. I'm curious if someone could point me to an official post about this or post it here? My main questions are:


  1. Are Safari Extensions officially deprecated in favor of Safari App Extensions?
  2. If yes, how soon do existing Safari Extensions need to be transitioned to a Safari App Extension? AKA: How long until my Safari Extension breaks or is no longer supported for new users?


Some background: I'm a web developer and would like to create a new version of my Safari Extension. I see the "suggested" way of doing this is now to create a Safari App Extension in Xcode, which requires building the extension primarily in Xcode and involves learning Swift (or Objective-C). This seems like a massive hurdle compared to Chrome, Firefox, and Opera who all support the same WebExtensions API. I'm wondering if it's worth the trouble of building a completly separate app extension for Safari, or if we can continue using the Safari Extension builder?

Replies

These are excellent questions. It's a shame that they were never answered.

I also have the same questions regarding Safari extensions vs. Safari App extensions.


My colleagues and I are developing an extension that needs to work on all major browsers, obviously including Safari.

On Chrome, Firefox and Edge, we are using the WebExtensions API, which allows us to share the same code base between them.

On Safari, we have to choose between legacy Safari Extensions (built with extension builder, HTML + Javascript) and new Safari App Extensions (xCode, Swift/Objective-C + Javascript).


From an architectural point of view, legacy Safari Extensions are quite similar to what other major browsers provide with WebExtensions API.

For this reason, we would like to use Safari Extensions, also hoping that Safari will support WebExtensions in the near future.


Is this a future-proof choice or do we absolutely need to develop a Safari App Extensions instead?

After messing around with this for the past week, I can say with near certainty: build a "legacy" Safari Extension. Safari App Extensions are a crippled mess. Unless your needs are incredibly basic, you will simply not be able to use a Safari App Extension. There is a reason why every major vendor of browser extensions (e.g., 1Password, Evernote, Pocket, etc.) uses legacy Safari Extensions and not Safari App Extensions.


Do you want to do something simple, like close a tab? It can't be done with a Safari App Extension. Safari App Extensions are extremely limited.


Legacy Safari Extensions are more similar to WebExtensions, which makes it easier to port a WebExtension. It'd be nice if Safari supported WebExtensions in the future, but I definitely wouldn't hold my breath on that, given that Apple is trying to convince people to move to Safari App Extensions, which are less similar to WebExtensions than legacy Safari Extensions.


Anyway, long story short: use a "legacy" Safari Extension.

Thank you very much for your reply.

Our main concern at the moment is related to the fact that, as you mentioned, Apple is pushing people to move to Safari App Extensions. More in particular:

  • will they stop supporting "legacy" Safari Extensions?
  • Should we decide to have our extension published in the extension gallery, are they still accepting Safari Extensions? How long does it take to have a Safari Extension published, compared to the time required for a Safari App Extension?

If they stop supporting legacy extensions, then they'll be killing the Safari integration for 1Password, Evernote, Pocket, and many other important applications. I don't see how Apple can stop supporting legacy extensions without making significant improvements to Safari App Extensions (i.e., doing whatever is necessary for an app like 1Password to be able to adopt them). If they stopped supporting legacy extensions right now, without making major changes to Safari App Extensions, then they'd basically be killing Safari as a browser for anyone that is even remotely a power user, given that Safari App Extensions have almost no uptake.


I don't know about the Safari Extensions Gallery. There are still extensions in there that are being used by tons of people, like 1Password and AdBlock Plus, so presumably it is alive and they are still accepting submissions. In our case, we're just including a version number in requests made by our extension, and when we issue a new version we'll present a message to our users telling them to upgrade manually, because I don't want to deal with the hassle and uncertainty of the Safari Extensions Gallery.

Ok, thank you very much for the clarifications.

Given all these considerations, legacy extensions sound like the best way to go, so I guess we will focus on them!

Are Safari Extensions officially deprecated in favor of Safari App Extensions?


Safari App Extensions are what we would like to see new extensions developed in, but legacy Safari Extensions continue to work.


2. If yes, how soon do existing Safari Extensions need to be transitioned to a Safari App Extension? AKA: How long until my Safari Extension breaks or is no longer supported for new users?


There is no set schedule for this, and it depends on adoption of Safari App Extensions.


What kind of funcitonality is missing from Safari App Extensions that you would like in your extension. Any use cases that we are missing we would love to know more about. Feel free to either reply here or file an Enhancement Request through bugreport.apple.com. We have made quite a few improvements and new APIs since the release of Safari App Extensions, and we'd like to continue making it better.

What specific functionality is missing in Safari App Extensions that you would like to see? Feel free to reply here, or it would be very helpful to have an enhancement request on bugreport.apple.com.


Please include any use cases for the features you would like to see supported as well?

It is not possible to close a browser tab or window via a Safari App Extension, even if the tab or window was opened by the extension. It is not possible to set the size or position of a browser window opened by a Safari App Extension.


Use case: our browser extension which allows users to import recipes, which is available here: https://www.anylistapp.com/recipes/browser-extensions


In Chrome and Firefox, when the user clicks a browser toolbar button to import a recipe, we open a new window that shows the recipe and allows them to edit it before saving. When the user saves the recipe (or cancels), we close the window that we opened. This is not possible with a Safari App Extension.


More generally, Safari App Extensions will always be fighting an uphill battle when it comes to adoption, because (1) they are very limited in what they can do (see above) and (2) they are different than every other browser. For strategic reasons, the Safari team should support the WebExtensions API, or as much of it as is practical. Otherwise the selection of extensions available for Safari will be limited, which will motivate power users to use Chrome or Firefox instead, which will mean there is even less of an incentive for developers to make the effort to develop Safari extensions (a vicious cycle).


https://developer.mozilla.org/en-US/Add-ons/WebExtensions

I second the suggestion that Safari should support the WebExtensions API. I wrote the Safari port of Vue.js devtools using the "old" way of building a Safari extension (Extension builder). I tried using the "new" way but it was way too confusing. If Safari would just support the WebExtensions API, the port would have been a lot easier and look almost identical to both the Chrome and Firefox extensions.

I find that the user experience for app extensions is confusing, especially when the "app" component does nothing at all. Why does the user have to start an app and then quit it, never to be used again? Now they have an app on their computer that does nothing. Safari Extensions don't have this problem.

We're all in trouble now. Support for developer-signed .safariextz extension has been *removed* in macOS Mojave / Safari Technology Preview 58. I'm already getting email from my users.


Have any of the major limitations of Safari App Extensions mentioned in this thread been fixed? As far as I can tell, there have been no changes to the Safari App Extension API in Mojave, so Apple has basically destroyed the Safari extension ecosystem with this release.

the ability to know if a tab is pinned or not would be a great addition


I have a session manager which has no idea about pinned tabs or not...

so tabs are recreated or ignored - depending on the state of the pinned tab

I am also starting to look into those app extensions and I feel extremely confused.

All the guides I see suggest that you already have an app, and then you create a new target to create this extension (https://developer.apple.com/library/archive/documentation/General/Conceptual/ExtensibilityPG/ExtensionCreation.html)

This may be valid in the case of a real app which wants to provide an extension, for example a password manager app which wants to have an integration with Safari through an app extension.

But when it comes to a traditional WebExtension style extension, what should the app be? I don't have a container app, I only want to create an extension for Safari... where do we start in such a case? Are there any skeletons of an empty container app allowing just to have an extension in it?

What are the requirements for that app? I suppose it can't be empty, or else it won't pass the review to push to the Apple Store...

If you download and install the beta of Xcode 10.1, there is a new project template to create a Safari App Extension app.


This app will have the UI and code already in place for your app to have an image for your extension. Clicking that image will take the user to your extension in Safari Extension Preferences.