Adapting Backbone.ajax in a Crossrider Browser Extension

We're working on a browser extension that needs to be deployed across Chrome, Firefox, and Internet Explorer. Crossrider is a platform that enables exactly this: write your extension in JavaScript using their API calls, and they'll convert the codebase to the various browser extension packages.

To reliably use cross-domain AJAX in your extension, you have to go through Crossrider's request.get() and APIs. Simple jQuery AJAX requests won't cut it due to browser portability problems. This means we needed to adapt Backbone to use this proprietary API for its persistence calls, like .save() and .fetch(). Here's how we overwrote Backbone.ajax to swap in the Crossrider API:

Read More