Monday, June 4, 2012

What is the best back button jQuery plugin?

I have found two plugins that enable the browser's back button to work across ajax interactions, but I can't determine which is better and why. The two plugins are history_remote and the history .

The history plug in is simpler and seems to provide all the functionality I need, but I'm not sure I understand enough about them to make an intelligent decision. For my application, I need the plugin to allow the back button to work through ajax interactions, and I need to be able to bookmark the page at any point through the interactions.

Which plug in is best in this scenario and why? Are there any other plug ins that I missed that might be better? Are there any limitations to these plugins that I'm missing (do they not work in certain situations etc)? Any information would be greatly appreciated.

Source: Tips4all


  1. jQuery Address provides strong cross-browser support for browser history and Ajax crawling:

  2. I'm really surprised the BBQ plugin by renowned Ben Alman didn't got a mention here

  3. Right now, in Internet Explorer 8, Firefox 3.6+, and Chrome 5+, you can bind callbacks to the window.onhashchange event and use it without any kind of plugin.

    Ben Alman has created a jQuery plugin that enables very basic bookmarkable #hash history via a cross-browser HTML5 window.onhashchange event.

    Basic usage:


    // Bind the event.
    $(window).hashchange( function(){
    // Alerts every time the hash changes!
    alert( location.hash );

    // Trigger the event (useful on page load).


    Supported browsers:

    Internet Explorer 8-9
    Firefox 2-4
    Chrome 5-6
    Safari 3.2-5
    Opera 9.6-10.60
    iPhone 3.1
    Android 1.6-2.2
    BlackBerry 4.6-5.

  4. Update: There is now the HTML5 History API (pushState, popState) which deprecates the HTML4 hashchange functionality. History.js provides cross-browser compatibility and an optional hashchange fallback for HTML4 browsers.

    jQuery History is my preferred choice. It can be found here:
    Provide cross browser support, binding to hashes, overloading hashes, all the rest.

    There is also a Ajax extension for it, allowing it to easily upgrade your webpage into a proper Ajax application:

    This is the solution chosen by such sites as and

    Overall it is well documented, supported and feature rich. It's also won a bounty question here How to show Ajax requests in URL?

  5. I'm successfully using history & anchors to make the back/forward buttons work on an AJAX page.

    Just define a function in the global scope to get called for every navigation event:

    function nav_event(hash) {
    // Some sort of navigation happened, update page


  6. This one is new and works on all recent browsers :

    have fun !


  8. There's a third jQuery plugin which also gives you back/forward button support:

    It doesn't require you to alter your hrefs with hash fragments, although it doesn't give you the bookmarking support you requested it might still be worth checking out.

  9. For a complete AJAX Navigation solution, you may want to check out

  10. For completeness of this list, jQueryTools also has one:

  11. This worked very well right off -

    And the code is:

    <a id="index.cfm?fuseaction=something" href="something">Some Link</a>

    <script type="text/javascript">
    $("a.buttons").history(function(event, hash) {

    <div id="rightcontent"></div>

    The hash variable always pulls in the href attribute so you need to put the link in some other attribute. I put it in the id attribute.

  12. You can use jQuery Address plugin

    There are some examples

    And these are specific on Ajax calls: (AJAX Crawling) (HTML5 state support)

  13. I miss here this example:
    It is very simple, but works as expected and has great fallback for IE6/IE7.

    It uses jquery.pathchange.js plugin, which can be found here: