tags:

views:

62

answers:

3

I am looking into using the HTML5 History API to resolve deep linking problems with AJAX loaded content, but I am struggling to get off the ground. Does any one know of any good resources?

I want to use this as it seems a great way to allow to the possibility of those being sent the links may not have JS turned on. Many solutions fail when someone with JS sends a link to someone without.

My initial research seems to point to a History API within JS, and the pushState method.

http://html5demos.com/history

+1  A: 

You may want to take a look at this jQuery plugin. They have lots of examples on their site. http://www.asual.com/jquery/address/

Nathan Totten
Again, this solution seems to fail when JS is off. I think history API has the power to work in conjunction with modrewrite so that links are always processed in the first instance by the server, without needing redirection from the JS layer.
Mild Fuzz
You are on the right track with the modrewrite. The solution of managing the history API and handling when the user doesnt have JS are really two separate things. If you dont have JS, you must handle the user with standard hrefs and server responses. The history API could be build as sort of a "nice to have" if the user's browser supports it.
Nathan Totten
Both the Express and State samples that ship with jQuery Address 1.3 work fairly well when JavaScript is disabled. The second one uses PHP with mod_rewrite.
Rostislav
@Nathan Totten Exactly my tact. I intend to build the site without JS, add AJAX elements and then use history to rewrite the URL, preserving deep linking. Theoretically, it should be a better method than any I have seen as the site will not depend on AJAX, at any stage
Mild Fuzz
A: 

if jQuery is available, you could use jQuery BBQ

sprugman
This seems to fail with JS turned off.
Mild Fuzz
that's probably true -- haven't looked into it. I would think that you'll have that problem with all js-library-based approaches. They're based on manipulating the hash part of the url.
sprugman
A: 

You cannot use the History API without JavaScript enabled. The API is a standardized JavaScript object that allows you to keep track of, and manipulate, the browser's page history. Without JavaScript, you cannot access the JavaScript object.

jsumners
ahh, but someone who is using javascript can copy a address rendered with it, and someone not using javascript could potentially still use it, so long as the mod-rewrite was set up correctly.
Mild Fuzz