Search code examples
history.jssammy.js

Comparison between Sammy.js/History.js/Nav.js


I was looking around for Single Page navigation handlers. Sammy.js was bit okay to crack so i created a sample SPA with proper navigation. Works great till now.(moreover, the fact the sammy.js is used by Twitter.. made me more curious.. ) :)

No issues!!

Looked around for alternative's and found History.js and Nav.js to be in same line.

History.js-- Follow the HTML5 History API as much as possible Provide a cross-compatible experience for all HTML5 Browsers (they all implement the HTML5 History API a little bit differently causing different behaviours and sometimes bugs - History.js fixes this ensuring the experience is as expected / the same / great throughout the HTML5 browsers)

Nav.js -- allows you to manage page-based navigation by binding the left and right arrow keys.

Sammy.js -- Like Sinatra, a Sammy application revolves around 'routes'. Routes in Sammy are a little different, though. Not only can you define 'get' and 'post' routes, but you can also bind routes to custom events triggered by your application.

All seems good in definition.


Solution

  • My point of view here is following (I like sammy.js, so I'm biased here, nothing objective just an opinion).

    History.js is all in HTML5 - so it crosses out all the support of IE8 and bellow. That is sometimes acceptable and, however, sometimes - not. Moreover, I am not completely sure that between gecko, trident, webkit - major browser engines - they all support that HTML5 history spec all the way without any differences.

    So for me History.js is all out. Then we have to differ between Nav.js and Sammy.js; and I don't see this as a competition. You ONLY have keyboard based navigation in Nav.js and since there is not much projects that don't use jQuery anymore, you can achieve that in Sammy.js by using http://api.jquery.com/category/events/keyboard-events/ and special routes for special events meaning next/previous page or whatever else floats your goat.

    Sammy.js is lightweight, efficient, scalable, reusable and fully cross-browser compatible.