开发者

Google Translate writing on the browser url bar

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


Anything after the # doesn't cause the page to reload.


You can use location.hash = 'en|fr|hello';

EDIT: see Modify the URL without reloading the page

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜