Oracle APEX | Handling Expire Session by Message to End User by JS

Welcome ..

Next JS Code:  just handling hang or suspend application when session expired by alert message to end user & redirect him to login page.

#APEX Ver: >= 5.0

Please put this code on Application level

window.onerror = function(msg) {

// Type you message here ..
    var clientMsg = 'Sorry, But Your Session Has Expired, I will redirect you to login page !';
// Type your app Id
    var appID = '145';
    

    var chk = 'SecurityError:';
    if (msg.includes(chk)){

        //Apex ver: >= 5.0
        apex.message.alert(clientMsg,function(){
                window.location = 'f?p=' + appID + ':LOGIN_DESKTOP';
            }
        );

        //Apex ver: < 5.0
        //alert(clientMsg);
        //window.location = 'f?p=' + appID + ':LOGIN_DESKTOP';

    }
    return true;
}

 

1- Now clear your session manually by this toolkit:
https://chrome.google.com/webstore/detail/clear-session/maejjihldgmkjlfmgpgoebepjchengka


2- Try to go to another page .. You will show alert message.

 

Regards,

Amr

 

 

You may also like...