2

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?

LBogaardt
  • 402
  • 1
  • 4
  • 25
  • 2
    Extensions usually utilize chrome extensions API which is available only in extensions so converting to a web app would only make sense for a very small amount of cases where the API isn't used. – wOxxOm Apr 08 '19 at 11:47
  • @wOxxOm You're talking about these (https://developer.chrome.com/apps/api_index). So each call to such a function would need to be converted to actions available to regular websites (if possible)? – LBogaardt Apr 08 '19 at 11:55
  • https://developer.chrome.com/extensions/api-index for extensions. – wOxxOm Apr 08 '19 at 11:57
  • Do you know of a 'wrapper' which could take the original code and make it function as-if it's a regular website? If anyone has advice on search terms I could Google for, that would also help. – LBogaardt Apr 08 '19 at 12:06
  • I don't know of any and I can't imagine how it would help since the API is crucial to functionality of most extensions. Apparently you're talking about some specific use case which I can't imagine. – wOxxOm Apr 08 '19 at 12:09
  • Yes, I guess it's very specific to the extension... In my case, the extension doesn't do anything special. It doesn't change the browser or add buttons etc. It merely serves an HTML page. Thanks for the refs, I'll continue Googling myself. – LBogaardt Apr 08 '19 at 12:12

1 Answers1

2

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.

LBogaardt
  • 402
  • 1
  • 4
  • 25