danludwig
danludwig

Reputation: 47375

Can history.js to URL deep linking without a hash or ? character?

This may be a duplicate. I have searched, but am not sure which terms to use. If you can find a duplicate, thanks, I will delete this question.

I've heard the history.js is the "best" deep linking ajax library because it has the best compatibility for older browsers. However every demo I have seen of this lib changes the URL using a ? character like /my/url?key=value or something like that.

I really like the slider on github when browsing through the source tree of a project. Clicking a folder for example will load the contents of the folder asynchronously while changing the full URL in the browser, without any hashes or querystring garbage.

Does anyone know if there is a library that accomplishes this? I'm not opposed to a library that would not work in non-html5 compliant browsers. Should I just use the pure HTML5 push state API?

Upvotes: 3

Views: 2380

Answers (1)

Carl
Carl

Reputation: 1816

PJAX (push-state ajax) is probably your best bet for this https://github.com/defunkt/jquery-pjax.

In uses the push-state API to allow it to use real URL's and if a browser doesn't support the push-state API, then it simply falls back to letting links work as normal (rather than loading page sections via AJAX).

If your not a JQuery user and still like the idea of PJAX, there's also an alternative standalone implementation (plugged shamelessly because i wrote it) you can get at https://github.com/thybag/PJAX-Standalone

Upvotes: 2

Related Questions