Some years ago I wrote an extension to add a new scheme to Firefox. Basically it this scheme just rewrote the URL into a normal supported scheme and then proceeded to load that page. The whole thing was just a short cut.
BUT, what with changes in extension APIs, it no longer works.
I’ve gone through the exercises of build your first / second extension:
- https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Your_first_WebExtension
- https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Your_second_WebExtension
And I notice that the reading the manifest.json documentation, it looks like
protocol_handler
can add new protocols, but only if they are of the form “web+foobar” or “ext+foobar”, which isn’t helpful for me. It also isn’t helpful that all it seems able to do is forward a URL to a website. I want to rewrite a URL in javascript, not forward it somewhere.
omnibox
can be used to rewrite stuff in the URL box, but only when prefixed with a keyword and space. And it seems to be limited to stuff typed in. The original extension I wrote would work from the command line (firefox ...
).
content_scripts
won’t do anything to rewrite a URL, and the match rules explicitly won’t handle anything other than a few predefined schemes.
chrome_url_overrides
doesn’t appear to add new schemes, just enables hardcoding a few pages.
Is URL rewriting something that has been suppressed in current Firefox? Am I out of luck?