javaajaxurlwicket

Changing URL via AJAX using 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

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?


Solution

  • 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