ajax history.

There is someone that has worked with ajax history?
I've followed http://railscasts.com/episodes/175-ajax-history-and-bookmarks
but it seems that the new javascript api history.pushState doesn't
work as well as jquery.ba-bbq.js

I haven’t played with Ajax history yet, but this new RailsCast might be helpful:
http://railscasts.com/episodes/246-ajax-history-state

What are you basing this on? pushState only works in browsers that support it, so Safari and a few other cutting-edge browsers, and nothing else, IIRC. I would guess that jQuery does some work-arounds to support lots more browsers, but I'm not sure if there are libraries available yet that use the native event if available and degrade to support functions where it's not. That would be cool.

If you look at the latest Railscast about this (couple weeks ago?) it shows how to make a system that degrades nicely to regular full reloads if pushState isn't there to do the sub-page-reloads-with-history.

Walter

I've seen that railscast, I'm using chrome which support pushState.
The problem is that ajax history with paginate works but if you, for
example, go to a site www.google.it or whatever internet site and then
push browser back button the page showed isn't an html page, but it
seems a text page.
Try.

Watching that 'cast, it seemed to me that you could bookmark the resulting URL, and restore your search/pagination/whatever state just fine. I haven't tried the google.it page in this respect, but if the URL changes to show the unique address of the current state of the page, then that's the goal and the goal has been met. Back button or bookmark and new session, it should appear the same either way.

Walter

You create a list and paginate through this using ajax just like the
railscast example.
Then go to a internet site.
Then push the browser back button and you see the page in history as
text and not as an html page.

Wow, sounds like a bug, either in the implementation of pushState by Google in their page, or by Chrome. Do you have this problem with Safari or Firefox?

Walter

My firefox version doesn't support pushState, I've the problem with Crome.
When I say "go to an internet site", I said google to make an example,
you can go to whatever site you want but when you push the browser
back button to call the page in history you see a text page and not an
html page.
I've read the railscast episode 246 and I have created an application
like that in railscast, so I've found this bug.
I paginate the list, click on various paginate links, then I go to an
internet site, push the back button and the browser call index.js.erb
that is in history but I see it like a text file.

p.s. sorry for bad english