Which Javascript history back implementation is the best?

There are implementations for history.back in Micrososft AJAX and jQuery (http://www.asual.com/jquery/address/).
I already have jQuery and asp.net ajax included in my project but I am not sure which implementation of history.back is better.

Better for me is:

  1. Already used by some large projects
  2. Wide browser support
  3. Easy to implement
  4. Little footprint

Does anybody know which one is better?

EDIT:

Another jquery plugin is http://plugins.jquery.com/project/history It is recommmended in the book JQuery Cookbook. This one worked well so far.

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

One alternative to jQuery Address is the nice jQuery history plugin. There are also URL Utils.

Reference: AJAX History and Bookmarks.

Method 2

If you are building an ASP.NET application then using ASP.NET Ajax Framework gives you many advantages and a nice-simple API to use server-side.

Below you can find an example that uses Browser History with ASP.NET Ajax

Create a Facebook-like AJAX image gallery

Both have a wide range support in browsers.
For me is easier to integrate Microsoft AJAX Framework in an ASP.NET page so again if you have an .aspx page it might be easier to work with ASP.NET AJAX

Method 3

If you don’t need exactly AJAX, i.e. updating only parts of the site on request is sufficient for you, then you can use invisible iframe as target for loading generated HTML file containing only JS script that updates/resets “updateable” parts of the site. This is cross-browser solution and doesn’t need address polling.

Example, but not in ASP: kociszkowo.pl (Polish site)

When you click there in the section icon and your browser supports javascript, link is modified before being fetched – target is changed to iframe and href is suffixed with .dhtml to inform server, that we’re interested in a special version of the page. If you press Back in your js-equipped browser, then previously fetched iframe page is loaded from the cache. Simple, but requires some decisions at architectural level.

This link modification is irrelevant here, it’s just the result of combining JS/non-JS world.

Method 4

In my experience, your best bet is using the same one that you have doing most (if not all) of your ajax calls. For instance, if you’re using asp:UpdatePanel’s, use the MS one – if you’re using jQuery.ajax, use the jQuery history plugin. If you’re doing a mix (which I’ve tried to avoid in my projects), I’d personally test with both and see which behaves better – if they both test fine, then it’s a bit of preference. Some may argue the Microsoft one would have better support, but jQuery’s history plugin may get more use and more mature.

http://msdn.microsoft.com/en-us/library/system.web.ui.updatepanel.aspx

http://docs.jquery.com/Ajax/jQuery.ajax#options


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x