Welcome Guest, Not a member yet? Register   Sign In
AJAX browser History

[eluser]Chris Williams[/eluser]
Now that I've got AJAX paginating smoothly, I was wondering if there is a simple way to enable history for the links using.

I've built it in jQuery, but the history plug-ins out there are old and busted. Anyone have any luck with this?

i am used History Keeper

you can find tutorial for it + jQuery here in russian Tongue
But you can use google for translation Smile

some links that could be interesting:
JavaScript State Manager
Really Simple History

[eluser]Chris Williams[/eluser]
I've a got a paginator app that will grap the page link and use that to produce an ajax action.

$(".paginate").livequery(function() {
        link = $(this).attr("href");
            type: "POST",
            url: link,
            data: "simple=true",
            success: function(html) {
        return false;
*yes, I did add a class to the paginate class.

My php code takes the _POST value of simple to just produce the records set and not the full page.

I find this useful so that the full link is shown for non-javascript browsers and search engines.

But there is no history for ajax with these links. It seems that the only way for these history scripts to work is to use a hash (#). I'm not sure of the best way to approach this. I would like to not use a hash to track history, but I don't see a way around it.

Also, if I incorporated a hash mark into my ajax script, how would I pull that in CodeIgniter?

[quote author="Chris Williams" date="1227516800"]It seems that the only way for these history scripts to work is to use a hash (#). I'm not sure of the best way to approach this.[/quote]

It's he only approach, the hash mark is the only part of the url you can change
without triggering an "reload" with the "new" url Smile

[quote author="Chris Williams" date="1227516800"]Also, if I incorporated a hash mark into my ajax script, how would I pull that in CodeIgniter?[/quote]

the hash is not send to the server, so everthing needs to be done on the client Wink

[eluser]Nathan Hammond[/eluser]
Hey Chris, narkaT,
One of my projects got linked to (JSSM). *grin*

There are two approaches to history management that allow for backward and forward movement. The one you'll see most people using is the hash-based solution I used in my approach. There is one other history manager that has a slightly different approach, instead using an iframe to handle everything: http://code.google.com/p/dshistory/

Both of these are completely valid, and their uses are dependent upon what you're trying to accomplish. An iframe creates a navigable but not bookmarkable history point, and the hash change creates both a navigable and bookmarkable history point.

JSSM and Really Simple History will eventually be merging into a single project, and JSSM is under active (near daily) development. I've not been pushing changes because they're not well enough tested (and break API). dsHistory is also under active development as well, approaching its 1.0 release.

Do your research and see what works best for your situation!


PS: The code for what you're trying to accomplish in JSSM looks something like $('.paginate').jssm(); but I can't tell you without seeing more.

[eluser]Chris Williams[/eluser]
If you promise not to laugh at my extremely beta dev site (beta as is, css totally busted in IE), I actually got a relatively functional version running using the jquery history plugin.

(not a permanent address)

I look forward to simpler plugins that can do the same thing down the road.

[eluser]Nathan Hammond[/eluser]
Klaus' plugin is solid (jQuery History), but it is out of date--make sure you noted the supported browsers.

If it makes you feel any better, we history solution developers are in discussions on how to make HTML5 be everything that we want it to be with its included history spec. Even better than that, we're discussing a shim implementation of the HTML5 history spec so that all current browsers are able to use the same functionality (or at least 75% of the functionality) immediately.

At that point, this history problem that we've been fighting with for a while now should cease to be an issue.


PS: I couldn't find the history example on your site.

[eluser]Chris Williams[/eluser]
I would love to see that put into html5. I'll have to keep an eye on how that turns out!

The history hashes are only a part of the pagination on that page. Everything else is a regular old link.

Theme © iAndrew 2016 - Forum software by © MyBB