1

Im new to ajax, jquery and javascript. When i learnt ajax and jquery, i also learned about back button issues and of course i learnt it too. But this solution uses the # anchors. But I want to change the url to the actual page just like to facebook. If you use facebook, you may have noticed that when you click an image, the url gets changed to the url of image but the page doesnt navigates away.

If Any one know about facebook like solution then please answer it.

  • I think you'd need a server-side process, use Curl for exemple – Jonathan de M. Aug 01 '12 at 03:30
  • This answer will get you started doing it with JavaScript: http://stackoverflow.com/questions/136458/change-the-url-in-the-browser-without-loading-the-new-page-using-javascript – Jory Cunningham Aug 01 '12 at 03:31
  • [**Try this**](http://fiddle.jshell.net/VF9jZ/show/) – qwertymk Aug 01 '12 at 03:37
  • The back button doesn't work in FaceBook - at least, in the mobile version served by default to the browser on my Android phone clicking the back button takes you right out of FaceBook. – nnnnnn Aug 01 '12 at 04:29

2 Answers2

0

I know you don't want to hear this, and I'm also new to AJAX and I'm also working on this right now, but i can give you the advise to use hashes first. Why?

Because hashes are accpted in any browser. If i were you I would now work out a solution that can be used with or without ajax (so there's a 'normal' navigation if ajax is not available, because web crawlers don't understand javascript).

If you have successfully worked out your solution, THEN you can add some functions to use the javascript pushState() (or replaceState()) method to manipulate the url. Don't underestimate this and use hashes at the beginning.

divaidee
  • 1
  • 3
-1

You are looking for Hash Navigation, also known as Fragment Navigation. Google has a very good article on this.

Here is a demo from them: http://gtv-resources.googlecode.com/svn/trunk/examples/location-hash-html.html

A.M.K
  • 15,539
  • 3
  • 27
  • 61