[Seaside] Re: How did you solve the ajax & back browser button problem?

Esteban A. Maringolo emaringolo at gmail.com
Wed May 28 14:03:39 UTC 2014


Sabine,

Could you post a small snippet of code of how you deal with the history
state pushing?

I can imagine how this could work using browser friendly URLs, but not when
dealing with sessions (unless you're using cookie tracking for sessions).

Regards!

Esteban A. Maringolo


2014-05-28 10:47 GMT-03:00 Sabine Knöfel <sabine.knoefel at gmail.com>:

> Hi Paul and Johan,
>
> thank you for your answers! It took me some time to choose, understand and
> implement a solution, but I think, now I have it.
>
> As Paul assumes, I do not use the ajaxifier either, I write the callbacks
> by myself.
>
> I integrated history.js [1].
>
> I was just finishing it a few minutes before.
>
> If someone needs more informations about it please ask.
>
> Regards
> Sabine
>
> [1] https://github.com/browserstate/history.js
>
>
> On Mon, May 19, 2014 at 6:57 PM, Johan Brichau-2 [via Smalltalk] <[hidden
> email] <http://user/SendEmail.jtp?type=node&node=4760713&i=0>> wrote:
>
>> Hi Sabine,
>>
>> Aaaah... the joys of the back button server-side rendered ajax
>> applications...
>>
>> As Paul points out, if you use the ajaxifier library, there is a solution
>> that uses the html5 history API [1].
>> The ajaxifier library transforms Seaside callbacks into browser ajax
>> requests on the client side. However, this means that they are still
>> executed as full page requests in Seaside itself.
>> If I remember correctly, it pushes the continuation key onto the state
>> history stack. A back button press can then make a call to fetch the
>> previous continuation.
>>
>> It makes the use of ajax transparant, but it also defeats many of the use
>> cases for it (imho).
>>
>> So you are probably not using the ajaxifier library (neither am I) and
>> you are writing the ajax calls yourself.
>> I'm afraid that means you have to implement a solution that fits your
>> needs as well :-( You will have to determine what it means to 'go to the
>> page before'. If it means 'going to the state before the last ajax call',
>> then you are in for some work.
>>
>> I once tried to implement this (at esug 2012 in Gent actually) but I
>> never finished it. Here is what I tried to do:
>>
>> Seaside ajax callbacks are changing the state of the current continuation
>> without copying the state and snapping off a new continuation. If you want
>> to be able to go back to the previous state before the ajax callback, an
>> ajax callback should first copy the session state (just as is done in a
>> full page request) before execution. The key for that state should go in
>> the history api (as in [1]). When a request for that state comes in, the
>> entire page should be re-rendered using the saved state.
>>
>> I think this should be able to get working using the abstractions
>> available in Seaside and I would love to hack on that at ESUG this year.
>> Unfortunately, promising anything before that is just not going to happen
>> because of lack of time :-/
>>
>> Johan
>>
>> [1] http://html5doctor.com/history-api/
>>
>> On 19 May 2014, at 14:23, Sabine Knöfel <[hidden email]<http://user/SendEmail.jtp?type=node&node=4759566&i=0>>
>> wrote:
>>
>> > Hi,
>> >
>> > my application does much with ajax calls and because of this, my
>> browser
>> > history is nearly empty.
>> > There are, indepently from pharo and seaside,  several solutions for
>> this
>> > problem described in the web.
>> >
>> > But after looking around for a while I want to ask how did (or how
>> would)
>> > you solve this problem within pharo and seaside?
>> >
>> > I want that my users can click the back button and go to the "page
>> before".
>> >
>> > Can I solve this with Seaside-REST? Which is the best way?
>> >
>> > Regards
>> > Sabine
>> >
>> >
>> >
>> >
>> > --
>> > View this message in context:
>> http://forum.world.st/How-did-you-solve-the-ajax-back-browser-button-problem-tp4759490.html
>> > Sent from the Seaside General mailing list archive at Nabble.com.
>> > _______________________________________________
>> > seaside mailing list
>> > [hidden email] <http://user/SendEmail.jtp?type=node&node=4759566&i=1>
>> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>> _______________________________________________
>> seaside mailing list
>> [hidden email] <http://user/SendEmail.jtp?type=node&node=4759566&i=2>
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>>
>>
>> ------------------------------
>>  If you reply to this email, your message will be added to the
>> discussion below:
>>
>> http://forum.world.st/How-did-you-solve-the-ajax-back-browser-button-problem-tp4759490p4759566.html
>>  To start a new topic under Seaside General, email [hidden email]<http://user/SendEmail.jtp?type=node&node=4760713&i=1>
>> To unsubscribe from How did you solve the ajax & back browser button
>> problem?, click here.
>> NAML<http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>>
>
>
> ------------------------------
> View this message in context: Re: How did you solve the ajax & back
> browser button problem?<http://forum.world.st/How-did-you-solve-the-ajax-back-browser-button-problem-tp4759490p4760713.html>
>
> Sent from the Seaside General mailing list archive<http://forum.world.st/Seaside-General-f86180.html>at Nabble.com.
>
> _______________________________________________
> seaside mailing list
> seaside at lists.squeakfoundation.org
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/seaside/attachments/20140528/88b454fe/attachment.htm


More information about the seaside mailing list