如何在浏览器网址框中更改网址? [英] how to change url in browser url box?

查看:126
本文介绍了如何在浏览器网址框中更改网址?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我真的很想知道为什么facebook和谷歌可以在不重新加载页面的情况下更改网址?他们只是更改了网站中的块或内容。

I really wonder why facebook and google can change the url without reloading the page? they just change the block or content in their site.

我注意到当我使用facebook时,点击新Feed时,网址为http:/ /www.facebook.com/并且页面没有重新加载,然后我点击消息,网址更改为http://www.facebook.com/messages/,页面仍然没有重新加载只是更改网站的内容块。

I notice that when I am using facebook, when click on the "new feed" the url is "http://www.facebook.com/" and the page didn't reload, then i click on "messages" the url changed to "http://www.facebook.com/messages/" and the page still not reload just change the "content" block of the site.

那么如何在不重新加载页面的情况下更改网址?

So how do I change url without reloading the page?

< b>编辑:我得到了答案。

这里有2个案例:

edit: i got the answer.
there are 2 cases here:


  • 浏览器支持html5(Firefox 3.6 +等):使用html5历史记录。 (例如:www.facebook.com => www.facebook.com/messages)

  • 浏览器不支持html5(IE6,IE7,IE8等):使用哈希标签(# )(例如:www.facebook.com => www.facebook.com/#!/messages)

希望这对谁有帮助我怀疑。

hope this help to who have doubt like me.

推荐答案

您是否查看了Javascript的历史API?

Have you looked into the history API for Javascript?

http://diveintohtml5.ep.io/history.html

编辑:您也可以将mod_rewrite与apache一起使用,但这会导致刷新。

You could also use mod_rewrite with apache and then, but that would cause a refresh.

或者有这个JQuery插件

Or there is this JQuery Plugin

http://www.asual .com / jquery / address /

这篇关于如何在浏览器网址框中更改网址?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆