Reputation: 4181
I just noticed that now when using Google Translate, the site is updating also the browser url bar in real time when you write something like:
http://translate.google.com/#en|fr|hello
But the page doesn't reload as I am used to see when using document.location.href=newurl
So, my questions are:
1 - How do they achieve this effect?
2 - Is it considered a good practice? I can see the benefits, reloading the site now doesn't make it lose the parameters, but it also makes the browser history quite dirty because is also keeping all the intermediate steps
Thanks in advance
Upvotes: 1
Views: 393
Reputation: 5780
You can use location.hash = 'en|fr|hello';
EDIT: see Modify the URL without reloading the page
Upvotes: 1