<div dir="ltr">Hi Esteban,<div><br></div><div>each time, the user clicks at a back button relevant point, with </div><div><br></div><div>History.pushstate(), [1]</div><div><br></div><div>I add the name of the view as another parameter to the url, like this (last one):</div>

<div><br></div><div><a href="http://ec2." target="_top" rel="nofollow" link="external">http://ec2.</a>...<a href="http://pute.amazonaws.com/RKM?_s=wDQUJI0FL-34s9Yn&amp;_k=PKTjORrGliXy8znn&amp;_v=RKATripOverView" target="_top" rel="nofollow" link="external">pute.amazonaws.com/RKM?_s=wDQUJI0FL-34s9Yn&amp;_k=PKTjORrGliXy8znn&amp;_v=RKATripOverView</a>.<br>

</div><div><br></div><div>When clicking at the back button [2], I extract the name of the view and can render [3] it.</div><div><br></div><div>Please note that code is not yet cleaned up it is the current working status.</div>

<div>Also, currently I do re-render the whole page when clicking at the back button, I want to change this, later.</div><div><br></div><div>This solution does only go back in the history of _views_ and does not load old objects. For my application, this is sufficient. Otherwise, you could add more information in the url variables, too and load the old objects, too.</div>

<div><br></div><div>[4] this is the js used (to be integrated in my Library)</div><div><br></div><div>I am interested in your opinion!</div><div><br></div><div>Regards</div><div>Sabine</div><div><br></div><div>[1]</div><div>

<div><span class="" style="white-space:pre">        </span>script</div><div><span class="" style="white-space:pre">                </span>add:</div><div><span class="" style="white-space:pre">                        </span>(JSStream new</div><div><span class="" style="white-space:pre">                                </span>nextPutAll: &#39;History.pushState&#39;;</div>

<div><span class="" style="white-space:pre">                                </span>arguments:</div><div><span class="" style="white-space:pre">                                                </span>(OrderedCollection</div><div><span class="" style="white-space:pre">                                                                </span>with: aViewClass  label </div>

<div><span class="" style="white-space:pre">                                                                </span>with: aViewClass label</div><div><span class="" style="white-space:pre">                                                                </span>with:</div><div><span class="" style="white-space:pre">                                                                        </span>(&#39;{1}&amp;_v={2}&#39;<span class="" style="white-space:pre">        </span></div>

<div><span class="" style="white-space:pre">                                                                                </span>format:</div><div><span class="" style="white-space:pre">                                                                                        </span>{theUrlString.</div><div><span class="" style="white-space:pre">                                                                                        </span>(aViewClass name)}));</div>

<div><span class="" style="white-space:pre">                                </span>yourself).</div></div><div><br></div><div>[2]</div><div><div><span class="" style="white-space:pre">        </span>^ &#39;</div><div><span class="" style="white-space:pre">        </span>var lock = false;</div>

<div><span class="" style="white-space:pre">        </span></div><div><span class="" style="white-space:pre">        </span> (function(window,undefined){</div><div>History.Adapter.bind(window,&#39;&#39;statechange&#39;&#39;,function(){  </div>

<div>if (lock == false) {  </div><div>window.location = History.getState().url;</div><div>}</div><div>});</div><div>})(window);&#39;</div></div><div><br></div><div>[3]</div><div>renderContentOn:</div><div><div>| theView |</div>

<div><span class="" style="white-space:pre">        </span>theView := self requestContext request queryFields at: &#39;_v&#39; ifAbsent: [ &#39;&#39; ].</div><div><span class="" style="white-space:pre">        </span>theView := Smalltalk at: theView asSymbol ifAbsent: [  ].</div>

</div><div><br></div><div>[4]</div><div><span class="" style="white-space:pre">        </span>aHtmlRoot javascript url:&#39;<a href="http://browserstate.github.io/history.js/scripts/bundled/html4+html5/jquery.history.js" target="_top" rel="nofollow" link="external">http://browserstate.github.io/history.js/scripts/bundled/html4+html5/jquery.history.js</a>&#39;.<br>

</div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 28, 2014 at 4:05 PM, Esteban A. Maringolo [via Smalltalk] <span dir="ltr">&lt;<a href="/user/SendEmail.jtp?type=node&node=4760722&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>&gt;</span> wrote:<br>

<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

        <div dir="ltr"><div class="">Sabine,<div><br></div><div>Could you post a small snippet of code of how you deal with the history state pushing?</div><div><br></div><div>I can imagine how this could work using browser friendly URLs, but not when dealing with sessions (unless you&#39;re using cookie tracking for sessions).</div>



<div><br></div><div>Regards!</div><div><br></div></div><div class="gmail_extra"><div>Esteban A. Maringolo</div>
<br><br><div class="gmail_quote">2014-05-28 10:47 GMT-03:00 Sabine Knöfel <span dir="ltr">&lt;<a href="http://user/SendEmail.jtp?type=node&amp;node=4760718&amp;i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>&gt;</span>:<br>

<blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><div class="">

<div dir="ltr">Hi Paul and Johan,<div><br></div><div>thank you for your answers! It took me some time to choose, understand and implement a solution, but I think, now I have it.</div><div><br></div><div>As Paul assumes, I do not use the ajaxifier either, I write the callbacks by myself.</div>





<div><br></div><div>I integrated history.js [1].</div><div><br></div><div>I was just finishing it a few minutes before.</div><div><br></div><div>If someone needs more informations about it please ask.</div><div><br></div>





<div>Regards</div><div>Sabine</div><div><br></div><div>[1] <a href="https://github.com/browserstate/history.js" rel="nofollow" link="external" target="_blank">https://github.com/browserstate/history.js</a><br></div></div>



</div><div class="gmail_extra"><br><br><div class="gmail_quote"><div><div class="h5"><div>

On Mon, May 19, 2014 at 6:57 PM, Johan Brichau-2 [via Smalltalk] <span dir="ltr">&lt;<a href="http://user/SendEmail.jtp?type=node&amp;node=4760713&amp;i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>&gt;</span> wrote:<br>





</div></div></div><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" class="gmail_quote"><div><div class="h5"><div><div>

        Hi Sabine,
<br><br>Aaaah... the joys of the back button server-side rendered ajax applications...
<br><br>As Paul points out, if you use the ajaxifier library, there is a solution that uses the html5 history API [1].
<br>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.
<br>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.
<br><br>It makes the use of ajax transparant, but it also defeats many of the use cases for it (imho).
<br><br>So you are probably not using the ajaxifier library (neither am I) and you are writing the ajax calls yourself.
<br>I&#39;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 &#39;go to the page before&#39;. If it means &#39;going to the state before the last ajax call&#39;, then you are in for some work. 
<br><br>I once tried to implement this (at esug 2012 in Gent actually) but I never finished it. Here is what I tried to do:
<br><br>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.
<br><br>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. 
<br>Unfortunately, promising anything before that is just not going to happen because of lack of time :-/
<br><br>Johan
<br><br>[1] <a href="http://html5doctor.com/history-api/" rel="nofollow" link="external" target="_blank">http://html5doctor.com/history-api/</a><br><br></div></div><div><div>On 19 May 2014, at 14:23, Sabine Knöfel &lt;<a href="http://user/SendEmail.jtp?type=node&amp;node=4759566&amp;i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>&gt; wrote:
<br></div></div><div><div><div><div><div><div class='shrinkable-quote'><br>&gt; Hi,
<br>&gt; 
<br>&gt; my application does much with ajax calls and because of this, my browser
<br>&gt; history is nearly empty.
<br>&gt; There are, indepently from pharo and seaside,  several solutions for this
<br>&gt; problem described in the web. 
<br>&gt; 
<br>&gt; But after looking around for a while I want to ask how did (or how would)
<br>&gt; you solve this problem within pharo and seaside?
<br>&gt; 
<br>&gt; I want that my users can click the back button and go to the &quot;page before&quot;.
<br>&gt; 
<br>&gt; Can I solve this with Seaside-REST? Which is the best way?
<br>&gt; 
<br>&gt; Regards
<br>&gt; Sabine
<br>&gt; 
<br>&gt; 
<br>&gt; 
<br>&gt; 
<br>&gt; --
<br>&gt; View this message in context: <a href="http://forum.world.st/How-did-you-solve-the-ajax-back-browser-button-problem-tp4759490.html" rel="nofollow" link="external" target="_blank">http://forum.world.st/How-did-you-solve-the-ajax-back-browser-button-problem-tp4759490.html</a></div>





&gt; Sent from the Seaside General mailing list archive at Nabble.com.
<br>&gt; _______________________________________________
<br>&gt; seaside mailing list
</div></div></div>&gt; <a href="http://user/SendEmail.jtp?type=node&amp;node=4759566&amp;i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br>&gt; <a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="nofollow" link="external" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a></div></div>_______________________________________________
<br>seaside mailing list
<br><a href="http://user/SendEmail.jtp?type=node&amp;node=4759566&amp;i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="nofollow" link="external" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>

        
        
        
        <br>
        <br>
        <hr noshade size="1" color="#cccccc">
        <div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif"><div>
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                </div><a href="http://forum.world.st/How-did-you-solve-the-ajax-back-browser-button-problem-tp4759490p4759566.html" rel="nofollow" link="external" target="_blank">http://forum.world.st/How-did-you-solve-the-ajax-back-browser-button-problem-tp4759490p4759566.html</a>
        </div></div></div><div><div>
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                To start a new topic under Seaside General, email <a href="http://user/SendEmail.jtp?type=node&amp;node=4760713&amp;i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a> <br><div class="">
                To unsubscribe from How did you solve the ajax &amp; back browser button problem?, <a rel="nofollow" link="external" target="_top">click here</a>.<br>


                <a href="http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" link="external" target="_blank">NAML</a>
        </div></div></div></div></blockquote></div><br></div>


        
        
        
<br><hr align="left" width="300">
View this message in context: <a href="http://forum.world.st/How-did-you-solve-the-ajax-back-browser-button-problem-tp4759490p4760713.html" rel="nofollow" link="external" target="_blank">Re: How did you solve the ajax &amp; back browser button problem?</a><div class="">

<div>

<div><br>
Sent from the <a href="http://forum.world.st/Seaside-General-f86180.html" rel="nofollow" link="external" target="_blank">Seaside General mailing list archive</a> at Nabble.com.<br></div></div><br>_______________________________________________<br>


seaside mailing list<br>
<a href="http://user/SendEmail.jtp?type=node&amp;node=4760718&amp;i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a><br>
<a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="nofollow" link="external" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>
<br></div></blockquote></div><br></div></div><div class="">
<br>_______________________________________________
<br>seaside mailing list
<br><a href="http://user/SendEmail.jtp?type=node&amp;node=4760718&amp;i=2" rel="nofollow" link="external" target="_blank">[hidden email]</a>
<br><a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" rel="nofollow" link="external" target="_blank">http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside</a><br>

        
        
        
        <br>
        <br>
        <hr noshade size="1" color="#cccccc">
        </div><div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif"><div class="">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                </div><a href="http://forum.world.st/How-did-you-solve-the-ajax-back-browser-button-problem-tp4759490p4760718.html" target="_blank" rel="nofollow" link="external">http://forum.world.st/How-did-you-solve-the-ajax-back-browser-button-problem-tp4759490p4760718.html</a>
        </div><div class="HOEnZb"><div class="h5">
        <div style="color:#666;font:11px tahoma,geneva,helvetica,arial,sans-serif;margin-top:.4em;line-height:1.5em">
                To start a new topic under Seaside General, email <a href="/user/SendEmail.jtp?type=node&node=4760722&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a> <br>
                To unsubscribe from How did you solve the ajax &amp; back browser button problem?, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>


                <a href="http://forum.world.st/template/NamlServlet.jtp?macro=macro_viewer&amp;id=instant_html%21nabble%3Aemail.naml&amp;base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&amp;breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml" rel="nofollow" style="font:9px serif" target="_blank" link="external">NAML</a>
        </div></div></div></blockquote></div><br></div>


        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://forum.world.st/How-did-you-solve-the-ajax-back-browser-button-problem-tp4759490p4760722.html">Re: How did you solve the ajax &amp; back browser button problem?</a><br/>
Sent from the <a href="http://forum.world.st/Seaside-General-f86180.html">Seaside General mailing list archive</a> at Nabble.com.<br/>