Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hashtags (Fragment identifiers) VS Javascript History API

Which one is better? Using fragment identifiers...

http://www.alinkthatdoesnotwork.com/#!/dir1/dir2/file.html

...or the new Javascript History API?

https://github.com/examplethatdoesnotwork/project/src/script.js

Or should I use both? (via fallback)

Aspects:

  • Compatibility/Support
  • Speed
  • Convenience
like image 618
auroranil Avatar asked Feb 23 '12 06:02

auroranil


1 Answers

Hashtags are a means to categorise content on Twitter, you mean fragment identifiers.

Using fragment identifiers to indicate what content to load via Ajax is a terrible idea. They are a hack that is fragile, search engine unfriendly (except with more hacks on both sides) and depends on JavaScript.

The history API is a robust system that is actually designed to do that job. The only problem with it is browser support, but (unlike the fragment identifier approach) it gracefully degrades to real URIs that will be passed directly to your server (which is what Github does).

Even Twitter appear to be about to switch to the history API.

like image 112
Quentin Avatar answered Oct 19 '22 23:10

Quentin