Wednesday, December 31, 2014

October #TMIL - Browser Extensions

From the Unfinished Business department:

At the Books in Browsers Conference hackathon in October, I worked with a few others to port the Readium Chrome extension, an in-browser epub reader, to Firefox. The core team had already been working on a branch which we didn't notice before diving in. Oops. However, it seems like they ran into the same issue that prevented us from going all the way: working with the user's filesystem from the extension.

While our Firefox port works, the only way to add a new epub is by moving the file into the project, adding an entry in a json file, then recompiling and re-adding the extension to Firefox. Rather than using local storage, our goal was to store the json file in the user's Firefox profile folder, and copy (or add a symlink to) epubs there as well. This way, if the user had to reinstall Firefox or cleared local storage, their settings and library would be preserved.

In the latest attempt, gaining 'chrome' privileges has been the blocker. We couldn't figure out how to successfully require('chrome') as the documentation shows, since the Firefox API's 'require' is a namespace collision with RequireJS, used by the core Readium Javascript! Later attempts with a colleague also left us scratching our heads. More details can be found in the project's Read Me.