0

As many of you have noticed, when you hit a link to switch from page to page in Google+ or facebook, the URL changes, the body changes but some parts of the page don't, like the chatbox. I believe AJAX can change a specific content of the page by requesting a PHP page from the server and get some results, but that won't change the URL.
Actually, I didn't know exactly how to search that in Google, so, any keywords/names/linkes will be strongly appreciated.
I'm using JQuery library for Javascript and Symfony2 framework for PHP, if this helps.

Nadjib Mami
  • 5,736
  • 9
  • 37
  • 49
  • 5
    possible duplicate of http://stackoverflow.com/questions/3997181/how-could-i-change-windows-location-without-reloading-and-hack?rq=1 – Waleed Khan Aug 30 '12 at 17:13
  • @arxanas, too bad, two important flaws: "Note that while this will change the URL of the page, it will not allow the user to click the back-button to go back to the previous state because you’re replacing the current state, not adding a new one. So, this is the correct behaviour." And: "Unfortunately, it seems like IE9 won’t be supporting this feature if we are to believe this [Wikipedia article]". I thinks that Return button is very important, and the fact that this feature isn't supported yet by IE9 will make it somehow a non-useful feature. – Nadjib Mami Aug 30 '12 at 22:31

2 Answers2

0

Look at the JQUERY load method.

http://api.jquery.com/load/

All you need to do is use a selector:

$('mydiv').load('newcontent');

Very powerful function. Look it up!

edit: Sorry missed that url change. The trick alot of times with the URL is around the Hashtag. If you look closely at the URL there will be a "#" pound symbol in there somewhere. This allows the site to store current state without a reload.

Currently there is no way to change the URL in the browser save for the bit after the hashtag with out fully reloading the site.

David
  • 144
  • 11
  • I know it David. I want to change the URL either. The first answer looks interesting, if you don't have a better solution. – Nadjib Mami Aug 30 '12 at 17:27
  • 1
    There is the possibility to change the URL, as in the possible duplicate: http://stackoverflow.com/questions/3997181/how-could-i-change-windows-location-without-reloading-and-hack?rq=1 – BenOfTheNorth Aug 30 '12 at 17:31
0

you can either use iframe or ajax to keep some part of your page static.To change url either you can use hash hack.

window.location.hash  = "pageidentifier"

or you can use the html 5 trick described in the url provided by arxanas

Tarun
  • 3,162
  • 3
  • 29
  • 45