views:

189

answers:

2

Is there a way to port a chrome extension to other browsers, without having to entirely re-write the code? My chrome extension uses the browser_action command to open "popup.html" in the extension window...

Update: I found this and found it only somewhat helpful for porting...

+3  A: 

It depends on the type of the extension, but not really. To answer your question more clearly, you need to specify what your extension is about: modify some pages (like userscripts/userstyles), extend browsers' features, or something else.

There are a few portability notes, however, that could help you to simplify this process:

  1. Don't write browser specific code. In some modern browsers you're able to use HTML5 features, like Web SQL Database API. It is difficult to emulate such behaviour on IE, for instance.
  2. Keep your JavaScript modular; don't use vendor specific JavaScript methods, and your code will be portable and will not rely on TraceMonkey or V8;
  3. Separate HTML from CSS and Javascript, don't make your code dirty and complicated.
floatless
Why would you care about IE compatibility? It doesn't support extensions.
serg
It does, but in a very-very-very-very 'unusual' manner.
floatless
+1  A: 

Apple provides some guidance on how to port convert a Chrome extension to Safari, but the problem you're going to run into is that each browser has a different set of allowed functionality for extensions. Even with Chrome to Safari, there are things you could do in Chrome you can't do in Safari, and visa versa.

Mark Trapp