You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Erik van Oosten <e....@grons.nl> on 2007/12/21 11:38:22 UTC

Ajax compatible url strategies?

Hello,

Our client is really into Ajax /and/ bookmarkable URLs.

What would be the best way to intercept and interpret anchor parameters
(e.g. after the '#' in the URL)? Do I have to write my own
UrlCodingStrategy?

What would be the best way to change the URL when an Ajax link was clicked?

Is there a way to do this all automatically? Would a
BookmarkableAjaxFallbackLink make sense?

Regards,
    Erik.


--
Erik van Oosten
http://day-to-day-stuff.blogspot.com/


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax compatible url strategies?

Posted by Erik van Oosten <e....@grons.nl>.
Hi,

> The part after # (hash) never gets to the server...Unless you e.g. use
xmlhttprequest

Ah. Didn't know that. But I can live with that. So I'll have to add a
handler on each page to detect # parameters and do a new (perhaps Ajax)
submit. Of course the handler should only fire upon a reload or initial
load.

> the only way that change url on client without reloading the page is
changing window.location.hash

That I knew. I was thinking of doing this as a part of an ajax response.
Not sure how yet, but I think I can do this.

So there are ways to do this. What I am most curious at is how to
cleanly add support for this in a Wicket application.

Here is rough idea, please shoot at it.
When the BookmarkableAjaxFallbackLink does its thing without Ajax it
will behave like a BookmarkableLink and encode the parameters according
to the linked BookmarkablePage. With Ajax, it will add the same
parameters with the same url coding rules, but after the '#' (client
side). Any page that can be reached by a BookmarkableAjaxFallbackLink
should detect a reload with '#' parameters and do a redirect to the same
page but with everything after the '#' converted to normal parameters
(e.g. after the '?').

How does this sound?

Regards,
    Erik.


Matej Knopp wrote:
> Hi,
>
> sorry, it's not possible to do. The part after # (hash) never gets to
> the server. It's client only. Unless you e.g. use xmlhttprequest to
> post it to server after the page has been loaded. And the only way
> that change url on client without reloading the page is changing
> window.location.hash (the part after # which doesn't get to server on
> normal request).
>
> -Matej
>
> On Dec 21, 2007 11:38 AM, Erik van Oosten <e....@grons.nl> wrote:
>   
>> Hello,
>>
>> Our client is really into Ajax /and/ bookmarkable URLs.
>>
>> What would be the best way to intercept and interpret anchor parameters
>> (e.g. after the '#' in the URL)? Do I have to write my own
>> UrlCodingStrategy?
>>
>> What would be the best way to change the URL when an Ajax link was clicked?
>>
>> Is there a way to do this all automatically? Would a
>> BookmarkableAjaxFallbackLink make sense?
>>
>> Regards,
>>     Erik.
>>
>>
>> --
>> Erik van Oosten
>> http://day-to-day-stuff.blogspot.com/
>>     
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org


Re: Ajax compatible url strategies?

Posted by Matej Knopp <ma...@gmail.com>.
Hi,

sorry, it's not possible to do. The part after # (hash) never gets to
the server. It's client only. Unless you e.g. use xmlhttprequest to
post it to server after the page has been loaded. And the only way
that change url on client without reloading the page is changing
window.location.hash (the part after # which doesn't get to server on
normal request).

-Matej

On Dec 21, 2007 11:38 AM, Erik van Oosten <e....@grons.nl> wrote:
> Hello,
>
> Our client is really into Ajax /and/ bookmarkable URLs.
>
> What would be the best way to intercept and interpret anchor parameters
> (e.g. after the '#' in the URL)? Do I have to write my own
> UrlCodingStrategy?
>
> What would be the best way to change the URL when an Ajax link was clicked?
>
> Is there a way to do this all automatically? Would a
> BookmarkableAjaxFallbackLink make sense?
>
> Regards,
>     Erik.
>
>
> --
> Erik van Oosten
> http://day-to-day-stuff.blogspot.com/
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
> For additional commands, e-mail: users-help@wicket.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@wicket.apache.org
For additional commands, e-mail: users-help@wicket.apache.org