开发者

location hash without the #

开发者 https://www.devze.com 2023-02-28 01:01 出处:网络
How to make this thing, i want when giving a location.has开发者_如何转开发h, to output in the addres bar like this, for example..

How to make this thing, i want when giving a location.has开发者_如何转开发h, to output in the addres bar like this, for example..

I have

location.hash = "asd"; 

And it will output #asd

But how to make to output only asd


If you want to modify the URL using JavaScript without actually loading a new page, you need to use the HTML5 history API and its pushState method.

  • http://diveintohtml5.ep.io/history.html
  • http://html5demos.com/history
  • https://developer.mozilla.org/en/DOM/Manipulating_the_browser_history#section_4


I think you want:

location.href
0

精彩评论

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