可以使用javascript重写URL客户端而无需重新加载页面 [英] Possible to rewrite url clientside with javascript without reloading page

查看:88
本文介绍了可以使用javascript重写URL客户端而无需重新加载页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以在客户端浏览器的URL字段中重写URL?

Is it possible to rewrite the URL in the URL-field on the client's browser?

因此当一个人点击我页面上的链接时会出现ajax(例如,显示一个标签)我希望网址显示动作而不刷新页面。

So when a person clicks on a link on my page something ajax happens (eg a tab shows up) i want the url to display the action without refreshing the page.

这可能吗?

推荐答案

你可以改变哈希/锚定网址的一部分(在#之后)。 URL的其余部分是只读的。

You can change the hash/anchor part of the URL (after #). The rest of the URL is readonly.

location.hash = "#value";

这篇关于可以使用javascript重写URL客户端而无需重新加载页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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