Search code examples
google-chrome-extensionfirefox-addonpolyfillsbrowser-extensionshim

Convert browser extension to regular website


It is possible to create Chrome or Firefox extensions which open a new tab and load a webpage. Such a webpage is basically HTML with some CSS and JavaScript. Therefore, in principle, it should be possible to open this HTML page locally from the extension's source code and get the same behaviour as the extension. Or to publish the HTML, CSS and Javascript online as a regular website.

Nonetheless, opening the main HTML page of the extension does not always result in a working website. I assume that, when an extension is loaded, additional scripts are run and permissions set by the browser (see the extension API's and the manifest).

What is required to turn a browser extension into a standalone website? Are there 'wrappers' (polyfill, shim) which can read the manifest and reproduce the behaviour of the extension?


Solution

  • Following wOxxOm's helpful comments, I realised some API calls can be intercepted using a shim or polyfill. This shim should re-implement the functions without making use of extension-specific API calls.

    I created a simple Git repository containing such a Javascript shim.