alphagov/whitehall — pull request #22 by floehopper (2012-08-09 15:35:02+00:00)
Title: Update browser location when using ajax document filtering behaviour.

* The intention is that the browser location and history acts the same
whether or not the ajax functionality is enabled. This means that we
should have bookmarkable URLs and a complete browser history for each
set of filter options.

* We're using the jQuery version of history.js to wrap the HTML5 History
API so that we can safely call `History.pushState` in any compliant
browser.

* I've added version 1.7.1 of history.js and it's the HTML5-only version.

* We are disabling the ajax filtering behaviour entirely if the browser
does not support the HTML5 History API and falling back to the
non-javascript implementation. This is because otherwise such users
would have an inconsistent browsing experience.

* No versions of IE yet support the HTML5 History API, but IE 10 is
expected to support it.

* It would be possible to support these other browsers, but it would
require considerably more work.

* Note that there is a odd bug in history.js where the `utf8` parameter
used by Rails as a workaround for an IE bug is not properly encoded in
the URL set when using `pushState`. @chrisroos has set up a demo of
this bug here [1] and there is a Github pull request for it here [2].

* However, since the value of this parameter is only important for IE at
form submission time, and we are disabling the ajax functionality for
IE, the corrupted value should not cause us a problem, althought it
doesn't look very pretty.

[1] http://bl.ocks.org/d/3303473/
[2] https://github.com/balupton/history.js/pull/108