0

I have implemented javascript code to solve ajax history problem Everything is working fine there no problem in it but I want to improve this code

As an example

When user see page (URL : http://www.example.com/pages/about) and if user click contact page I append hash code to url like this

window.location.hash="!"+hash;

so the URL will look like http://www.example.com/pages/about#!contactus

whenever user clicks the page hash code will be change

If user press back button or go back in anyway hash will be changed as you all know already

using that hash change content of my web site

so back to main point what I want to do is don't want to append hash at address bar (something like Facebook do {you can see this in latest browser})

Xavier T.
  • 40,509
  • 10
  • 68
  • 97
  • 1
    possible duplicate of [How to do awesome refreshless page changes like GitHub](http://stackoverflow.com/questions/4664166/how-to-do-awesome-refreshless-page-changes-like-github) – Quentin May 04 '12 at 12:21
  • for code improvement suggestions, you should post this on [codereview.stackexchange](http://codereview.stackexchange.com/). good luck. – Eliran Malka May 04 '12 at 12:22
  • i did not know i have no idea how do i search this so created new question @Quentin –  May 04 '12 at 12:24

1 Answers1

1

You should look at new History API additions in HTML5. There's a somewhat long introduction from "Dive into HTML5" book but I like it a bit more than MDN article.

Also there's a great library called History.JS that abstracts away the differences between the new API and old hash-based approach. I also works around many incompatabilities among browsers which is great! It works with jQuery, Prototype, MooTols and Zepto.