2

So I am creating just a fairly normal content based website that is going to load new pages/content in via AJAX for a smoother user experience and some simple transitions. I see a ton of people using a hashbang for similar implementations.

My question is why not just use regular URLs and have server-side determine if the regular page should be served or JSON/XML/etc based on the XMLHttpRequest var? At my first glance here it seems to make more sense to have one URL and I am curious why I see no mentions of this idea/approach in my initial searchings. Perhaps I am just missing something...

ANSWER: I missed that updating a full URL without a page load was not possible before HTML5 history. That is where my confusion arose.

Kevin Brown-Silva
  • 40,873
  • 40
  • 203
  • 237
gokujou
  • 1,482
  • 3
  • 15
  • 27

1 Answers1

1

If you only have 1 url, users can't bookmark anything on your site. So you need to do something.

So you can either use hashbangs (aka anchors), or, if you are targeting reasonably new browsers, html5 history.

You can't use regular urls because when you change a url, the entire page reloads.

hvgotcodes
  • 118,147
  • 33
  • 203
  • 236
  • I meant to come across as still updating the URL. I see now that the full page URL update is a recent feature with HTML5. – gokujou Jul 25 '12 at 01:25
  • What I was saying is that I intended to update the URL and not just have one URL. I failed to see that prior to HTML5 history, you could not just update the full URL without a page load. – gokujou Jul 25 '12 at 01:30