Custom protocol handler to provide local resources.

I'd like to provide custom pages with extension that allows users to access custom UI for example options page etc.


On WebExtensions standard that's done quite easily just providing custom HTML page and opening it in the browser (that's actually how it was earlier with safari legacy extension), You've could've just opened


safari-extension://id/options.html or something along the lines. How can I achieve something like this with the Safari App Extension?

I know that I can point directly to the bundled resources, but the URL would should full path to that file, which is not ideal.


Is there a way to maybe register custom protocol that extension could interpret?

You can call:


https://developer.apple.com/documentation/safariservices/sfsafariextension/3075406-getbaseuri


Which will give you an NSURL object tthat points to your extension's bundle. If you are trying to do this in a content script, then you can call safari.extension.baseURI, which will give you the same information.


Hope this helps!

Custom protocol handler to provide local resources.
 
 
Q