I've researched this problem a little bit and have an interesting question.

I would like to have a customized version of ActionLink (let's call it
HashActionLink). It should work as follows:

- if client-side JavaScript is enabled (and thus history events work), it
reacts to hash change events and updates specified zone
- if client-side JavaScript is disabled, it falls back to normal ActionLink
behavior

I suppose it might be handled using JS DOM manipulation in @AfterRender
phase.
Are there any other options to do that?



On Sun, Oct 27, 2013 at 4:24 PM, Ilya Obshadko <ilya.obsha...@gmail.com>wrote:

> Thanks for suggestions. I'm going to take a look at jquery-hashchange.
>
>
> On Sun, Oct 27, 2013 at 9:07 PM, Dmitry Gusev <dmitry.gu...@gmail.com>wrote:
>
>> I wouldn't expect this functionality from Tapestry, because it can't and
>> shouldn't compete with client-side frameworks that should do this job.
>>
>> Tapestry 5.4 allows better pluggable client-site integration, so using
>> some
>> 3rd party client-side library for this stuff sounds reasonable. I'm sure
>> you've heard of this resource: http://todomvc.com and I'd try picking one
>> from there to integrate with tapestry.
>>
>> To start I'd recommend you to look at
>> http://benalman.com/projects/jquery-hashchange-plugin/ and maybe to
>> http://backbonejs.org/#Router as an example of handling hashchanged in
>> client-side MV* frameworks.
>>
>> I found jquery-hashchange-plugin very handy and it works very well for
>> simple cases where you simply want to trigger zone update from client-side
>> on hash changed (or initial page load).
>>
>>
>>
>> On Sun, Oct 27, 2013 at 12:41 PM, Ilya Obshadko <ilya.obsha...@gmail.com
>> >wrote:
>>
>> > That's understandable. However, *client-side* part of Tapestry might
>> deal
>> > with URL anchors in one way or another, for example, transforming them
>> to
>> > some kind of component events being sent to server over AJAX.
>> >
>> > This is actually what I'm interested in: to create some kind of 'bridge'
>> > between browser history events and Tapestry server-side events.
>> >
>> >
>> > On Sat, Oct 26, 2013 at 5:06 PM, Dmitry Gusev <dmitry.gu...@gmail.com
>> > >wrote:
>> >
>> > > Please note:
>> > >
>> > > Anchors or URL fragments as they are referred to in RFC
>> > > 1738<http://www.ietf.org/rfc/rfc1738.txt>,
>> > > > are not sent by the client to the server, when requesting for a
>> > resource.
>> > > >
>> > >
>> > >
>> > > So dealing with anchors is completely client-side job.
>> > >
>> > > Of course you can redirect from server-side to anchored URL.
>> > >
>> > >
>> > >
>> > > On Sat, Oct 26, 2013 at 6:54 AM, Ilya Obshadko <
>> ilya.obsha...@gmail.com
>> > > >wrote:
>> > >
>> > > > Found this thread while looking for a similar solution.
>> > > >
>> > > > - I'm using AJAX calls heavily and still want to be able to
>> represent
>> > > each
>> > > > page state as a separate URL.
>> > > > - I need to use anchor part of the URL in page activation handlers
>> > > >
>> > > > Is there any proper way to do that in 5.4?
>> > > >
>> > > >
>> > > >
>> > > > On Thu, Dec 1, 2011 at 8:04 AM, trsvax <trs...@gmail.com> wrote:
>> > > >
>> > > > > I was thinking about using that same library and gave up on the
>> whole
>> > > > idea
>> > > > > because of the emailing links problem and just went back to
>> reloading
>> > > the
>> > > > > whole page. The URL changes and the content changes. IMHO that is
>> the
>> > > > "more
>> > > > > native" approach. The history.js approach is full of difficult
>> > problems
>> > > > > such
>> > > > > as emailing a link to someone that does not run javascript.
>> Perhaps
>> > you
>> > > > > don't care about that edge case but I decided it was better to
>> > > > concentrate
>> > > > > on making the whole page load faster than solving all the AJAX
>> > history
>> > > > > problems. That said I do see the appeal and if everything
>> supported
>> > the
>> > > > > HTML
>> > > > > 5 way I might feel differently. I'm not knocking history.js and I
>> > think
>> > > > > #state is a cleaver hack but if the goal is to email links I think
>> > > > > reloading
>> > > > > the whole page is the only solution.
>> > > > >
>> > > > > --
>> > > > > View this message in context:
>> > > > >
>> > > >
>> > >
>> >
>> http://tapestry.1045711.n5.nabble.com/Tapestry5-Anchor-Usage-for-Navigation-tp5036547p5036735.html
>> > > > > Sent from the Tapestry - User mailing list archive at Nabble.com.
>> > > > >
>> > > > >
>> ---------------------------------------------------------------------
>> > > > > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
>> > > > > For additional commands, e-mail: users-h...@tapestry.apache.org
>> > > > >
>> > > > >
>> > > >
>> > > >
>> > > > --
>> > > > Ilya Obshadko
>> > > >
>> > >
>> > >
>> > >
>> > > --
>> > > Dmitry Gusev
>> > >
>> > > AnjLab Team
>> > > http://anjlab.com
>> > >
>> >
>> >
>> >
>> > --
>> > Ilya Obshadko
>> >
>>
>>
>>
>> --
>> Dmitry Gusev
>>
>> AnjLab Team
>> http://anjlab.com
>>
>
>
>
> --
> Ilya Obshadko
>
>


-- 
Ilya Obshadko

Reply via email to