开发者

change url address using Javascript [duplicate]

开发者 https://www.devze.com 2023-03-01 10:45 出处:网络
This question already has answers here: Closed 11 years ago. Possible Duplicate: How to rewrite URL without refresh, like GitHub.com
This question already has answers here: Closed 11 years ago.

Possible Duplicate:

How to rewrite URL without refresh, like GitHub.com

let say I have variable in Javascript

var currentpage = 0;
开发者_Python百科

my address page address is www.xyz.com/page/1

when I click somewhere and js function trigger

currentpage = 1
//Here I want to change/rewrite www.xyz.com/page/2
//Without redirecting to this page


See pushState (browser support currently limited).


You can't. You have to use the '#' or '#!' notation and pass the page number after it, then do trigger some js on load to figure out which page to display.

0

精彩评论

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