简体   繁体   中英

How to port a firefox extension to google chrome?

If I create firefox extension, will it run in google chrome also with some changes? I found google chrome extension developing at, http://developer.chrome.com/extensions/ it looks different than XUL. So does that mean these application are not browser compatible? IE would have different language, Am i correct? If all are different then how to develop these three browser compatible application?

There is no XUL support in Google Chrome.

In order to port you extension to different browser you should extract some common part of it, which works solely with web content and does not rely on browser specific features. This part can be shared among extensions (mush the same as you can use jQuery and other libs on all extensions regardless to platform).

The other parts of your extension, including those dealing with UI, must be customized using specific APIs of every browser. For example, for Google Chrome you should use popup pages or options pages for UI. They are HTML+CSS+JavaScript, not XUL.

Chrome and Firefox now use very similar APIs so porting is not difficult. Mozilla has a great overview of the potential issues here: Building a cross-browser extension

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM