<div dir="ltr">Hi Johan,<div><br></div><div>yes, it helped, thank you!</div><div><span style="font-size:12.800000190734863px">onError: did not work but I already had a global error handler and this works fine.</span><br></div><div><span style="font-size:12.800000190734863px"><br></span></div><div><span style="font-size:12.800000190734863px">Have a nice day</span></div><div><span style="font-size:12.800000190734863px">Sabine</span></div></div><div class="gmail_extra"><br><div class="gmail_quote">2017-04-21 8:13 GMT+02:00 Johan Brichau-2 [via Smalltalk] <span dir="ltr"><<a href="/user/SendEmail.jtp?type=node&node=4943036&i=0" target="_top" rel="nofollow" link="external">[hidden email]</a>></span>:<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"><span class="">

        Hi Sabine,<div><br></div><div>If you include a period check, you automatically keep the session alive if the ‘check in’ interval is shorter than the session expiration duration.</div><div>If the session is dead, the callback cannot execute because it is no longer there, so you cannot write code that checks if the session is still alive from within you Seaside code on the server.</div><div><br></div><div>You can only do something on the client, if the Seaside session is reported to be ‘dead’ (i.e. when receiving an http response 403).</div><div>Using an error handler for the jquery ajax requests is the way we deal with those situations. It boils down to this:</div><div><br></div></span><div><div dir="ltr"><span class=""><div>        script:</div><div>            (html jQuery this load</div></span><span class=""><div>                html: [ :r | … ];</div><div><span class="m_6549731349709680585Apple-tab-span" style="white-space:pre-wrap">          </span>onError: (html javascript alias: handleError))</div></span><span class=""><div>               interval: 30 seconds);</div><div>        with: [ html render: something].</div><div><br></div><div><br></div></span><span class=""><div>function handleError( event, jqxhr, settings, thrownError ) {</div><div><span class="m_6549731349709680585Apple-tab-span" style="white-space:pre-wrap">       </span>if(jqxhr.status == 403)</div><div><span class="m_6549731349709680585Apple-tab-span" style="white-space:pre-wrap">            </span>window.location = '/‘;</div><div>}</div><div><br></div><div>Instead of writing this for each ajax callback, you can also set a global ajax handler on the document when the page loads: <a href="http://api.jquery.com/category/ajax/global-ajax-event-handlers/" rel="nofollow" link="external" target="_blank">http://api.jquery.com/<wbr>category/ajax/global-ajax-<wbr>event-handlers/</a></div><div>You might also want to take a look at this chapter: <a href="http://book.seaside.st/book/in-action/session/recovering" rel="nofollow" link="external" target="_blank">http://book.seaside.<wbr>st/book/in-action/session/<wbr>recovering</a> if you want to respond in a specific way when sessions have expired</div><div><br></div><div>Does this help you?</div><div><br></div><div>cheers</div><div>Johan</div></span></div></div><div><br><div><blockquote style='border-left:2px solid #CCCCCC;padding:0 1em' style="border-left:2px solid #cccccc;padding:0 1em" type="cite"><div><div class="h5"><div>On 20 Apr 2017, at 18:04, Sabine Manaa <<a href="http:///user/SendEmail.jtp?type=node&node=4942970&i=0" rel="nofollow" link="external" target="_blank">[hidden email]</a>> wrote:</div><br class="m_6549731349709680585Apple-interchange-newline"></div></div><div><div><div class="h5"><div dir="ltr"><div>Hi,</div><div><br></div><div>is anyone having an idea for a solution of this problem: </div><div><br></div><div>I want that my seaside web app redirects the user to another page (login page) if the session is "dead*". The special point I am looking for is: </div><div><br></div><div>This should happen ALSO if the user does NOT click on this page or does something. Also if the user switches to another tab. </div><div><br></div><div>So, if he comes back to the browser/to my apps tab, he should see a message "you have already been logged out".</div><div><br></div><div>I assume I have to periodically check if the session is alive and played around with </div><div><br></div><div>html paragraph</div><div>        script:</div><div>            (html jQuery this load</div><div>                html: [ :r | "here check for session and if not there, redirect"</div><div>                    (Array with: self currentPerson with: (self application sessions includes: self session))</div><div>                        inspect ];</div><div>                interval: 30 seconds);</div><div>        with: [ html render: something].</div><div><br></div><div>but if the session is dead, the code "here check ..." is no longer executed.</div><div>I am not sure if this is the right idea...</div><div>Anyone already implemented something like this?</div><div><br></div><div>I am not looking for a redirect after clicking somewhere in the app, I have this and it works fine. </div><div><br></div><div>Regards</div><div>Sabine</div><div><br></div><div>* I have read a little about "dead" sessions and know that they are collected away at unpredictable time. With "dead" I mean that if the user would click at the app, he would be transferred away.</div></div></div></div>
______________________________<wbr>_________________<br>seaside mailing list<br><a href="http:///user/SendEmail.jtp?type=node&node=4942970&i=1" rel="nofollow" link="external" target="_blank">[hidden email]</a><br><a href="http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside" target="_blank" rel="nofollow" link="external">http://lists.squeakfoundation.<wbr>org/cgi-bin/mailman/listinfo/<wbr>seaside</a><br></div></blockquote></div><br></div><br>______________________________<wbr>_________________
<br>seaside mailing list
<br><a href="http:///user/SendEmail.jtp?type=node&node=4942970&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.<wbr>org/cgi-bin/mailman/listinfo/<wbr>seaside</a><br>

        
        
        
        <br>
        <br>
        <hr noshade size="1" color="#cccccc">
        <div style="color:#444;font:12px tahoma,geneva,helvetica,arial,sans-serif">
                <div style="font-weight:bold">If you reply to this email, your message will be added to the discussion below:</div>
                <a href="http://forum.world.st/redirect-user-if-session-dead-without-clicking-him-at-the-page-itself-tp4942774p4942970.html" target="_blank" rel="nofollow" link="external">http://forum.world.st/<wbr>redirect-user-if-session-dead-<wbr>without-clicking-him-at-the-<wbr>page-itself-tp4942774p4942970.<wbr>html</a>
        </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="/user/SendEmail.jtp?type=node&node=4943036&i=1" target="_top" rel="nofollow" link="external">[hidden email]</a> <br>
                To unsubscribe from Seaside, <a href="" target="_blank" rel="nofollow" link="external">click here</a>.<br>
                <a href="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" rel="nofollow" style="font:9px serif" target="_blank" link="external">NAML</a>
        </div></blockquote></div><br></div>


        
        
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://forum.world.st/redirect-user-if-session-dead-without-clicking-him-at-the-page-itself-tp4942774p4943036.html">Re: redirect user if session dead without clicking him at the page itself</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/>