开发者

Change URL basename

I'm using AJAX to display a transition betwee开发者_JAVA技巧n pages and I'd like to change the URL basename when the user clicks on a link. I'm using PHP to be able to use URLs like mydomain.com/mypage, so I'd like to be able to change "mypage" to something else like "mysecondpage". How may I do that?


You can use history.pushState, but it is firefox-only. The standard way to do it is by using different hashes (e.g. mydomain.com/#mypage --> mydomain.com/#mysecondpage). This can be done simply by changing window.location.hash.


You can't, unless you use a hash #likethis.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜