I'm looking for a solution to bootstrap a client side app (written in Backbone.js) on the server, so that I can serve correct content to crawlers and non-js consumers.
I've been playing around with jsdom & nodejs in an attempt to bootstrap the app, and can get it as far as loading in the basic template content, but the app appears to never start.
I've tried 2 different solutions to make sure that I have all the dependencies necessary and the app is loading correctly:
- I tried using jsdom.env() with all the scripts usually included inline.
- I tried using jsdom.jsdom() and making sure that FetchExternalResources, ProcessExternalResources, and MutationEvents were all correct and on.
Neither seem to fire the window.onload event though. I'm wondering if jsdom possibly doesn't fire this, or maybe calls it's callback after it would have normally been fired?
Is this a task that is possible in jsdom?