开发者

changing URL via AJAX using wicket

开发者 https://www.devze.com 2023-03-17 18:42 出处:网络
Is there a way to make an AJAX call alter the current page URL without redirecting or reloading the page, in Apache Wicket?

Is there a way to make an AJAX call alter the current page URL without redirecting or reloading the page, in Apache Wicket?

For example, say we are in the url:

localhost:8080/someUrl
开发者_如何学Go

I'd like that when I click an ajax link, some action is performed, and the url changes to, say:

localhost:8080/otherUrl

without redirecting, just changing the url displayed in the browser. Is this even possible?

Thanks!

Manuel


Actually you can ! But this is not related to Wicket at all. This is what the new History API in HTML5 is about. Just search for "html5 History API example" in Google and enjoy.


The only part of the url you can change with javascript is the hash

You could change localhost:8080/#/someUrl to localhost:8080/#/otherUrl

Do this with window.location.hash

Here's an example of a flash site which uses this concept to allow for deep-linking URL's: http://www.2advanced.com


Help make this feature happen, vote (or contribute!) for https://issues.apache.org/jira/browse/WICKET-5290


No, it isn't. If you change the location in the browser, a new request is made to that URL.

(You do that with window.location.href = newUrl, but the page reloads)

0

精彩评论

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

关注公众号