0

I am currently building a website but in an effort to prevent not necessary data to be loaded i decided to split but the website into serveral divs and load the content inside the div.

Because of this when i click on the back button i dont go to the previous location on the site but to where i was browsing before. Is there a way to solve this without rewriting the entire site? So for instance on my site there would be a members page that would be called upon using javascript by loading $('#content').load('members.php?id=$id');

For instance by creating a fake location...index.php#fakelocation (which contains the specific content i just loaded)

Can anyone give me a push in the right direction (or if this is impossible id like to hear it to)

Wouter
  • 137
  • 10
  • Possible duplicate of [Good tutorial for using HTML5 History API (Pushstate?)](http://stackoverflow.com/questions/4015613/good-tutorial-for-using-html5-history-api-pushstate) – Alexander O'Mara Sep 25 '16 at 22:52

1 Answers1

1

I think what you're looking for is a combination of the History API and AJAX.

Lucky for you, there's a great library called PJAX that combines these technologies.

Without knowing more about how your backend works, I can't comment on additional steps to optimize the whole application, but PJAX is friendly with any number of server-side technologies.

August Miller
  • 1,224
  • 1
  • 10
  • 6