Is there a way to redirect the user to some URL or route automatically once the session has timed out? I tried finding an event for that I can use, but it seems there is no such thing.

It would be ok if the redirect happens right after the next action the user takes. It would be perfect if it happens automatically without any user interaction.


1 Answer 1


You could implement that check on the client side using JavaScript. Have a look at /js/mage/cookies.js and the get() function to check for existing sessions.

Without user interaction means that you either need to poll in the background and check the server response which is ok too in case you rely on this features, but in my opinion not very "elegant".

Also, you could check on page load


and load custom client side code to handle possible session timeouts.

  • Thanks sounds good. Id like to use the $this->helper('customer')->isLoggedIn() way ... thing here is, how do I know if the user was logged in before? Could you give me some more details about how to do it in JavaScript in cookies.js? Thanks!
    – Arnie
    Sep 1, 2015 at 8:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.