Liferay DXP 2026.Q4    |    Release Webinar: 18 November 2026    |    Replay coming soon! 

Blogs

Custom Liferay Session on expiration

Julian AFFAIRE
Julian AFFAIRE
Lecture inférieure à une minute
Just few words to explain how to customize the behaviour when the Liferay Session expires (no hook :) ).
 
This javascript will extends the expire function of the Liferay.Session javascript object. It makes the default behaviour and then disables all the links and the buttons on the page and then adds a refresh link in the pink header of the expired session.
 
The custom javascript to add in your theme:
$(function () {    
   AUI().use('liferay-session', function(A) {
      if(Liferay.Session) {
         Liferay.Session.expire = function() {
             var instance = this;
                instance.set('sessionState', 'expired', {});
            $('a,button').css("pointer-events", "none").css("opacity", "0.6");
            $("body div.alert.alert-block.popup-alert-warning.alert-error").append("<a class='refresh' href=''>Refresh</a>");
         };
      }
   });
});

 

Commentaires sur la page
I tried this in Liferay 7 it doesn't work is there another way of customizing the expires message?

Related Assets...

Aucun résultat trouvé

More Blog Entries...

Himanshu Chauhan
novembre 20, 2026
Tony Lim
novembre 19, 2026