Sunday, September 10, 2023

Custom Timeouts for Citrix StoreFront - Revisited

In my last blog post I showed you how to create custom StoreFront timeouts based on a user's AD group membership. Once the custom timer expires, the user is logged out of StoreFront. Under certain circumstances this might cause unexpected behavior. 

For example, the default action when the user clicks the logoff button in StoreFront is to disconnect any Citrix sessions launched from that PC. This may be changed under Workspace Control:

You probably don't want your Citrix sessions to disconnect when StoreFront times out (what if you were in the middle of an important document in your Citrix session?). You would need to sign on to StoreFront again to continue working. It would be a lot worse if you had the logout action set to Terminate (you would lose all your work!).

To get around this "gotcha", we need to take advantage of a StoreFront "extension" that allows us to dynamically change the logout action on the fly. We define the new action at the top of the file:
var ICAaction    = "none";

"None" means to leave any running Citrix sessions alone - do not disconnect or terminate them. We then call the beforeWebLogoffIca StoreFront extension, and tell it to swap our new logout action for the default one:

CTXS.Extensions.beforeWebLogoffIca = function(defaultAction) {
log("About to log off ... default ICA action: " + defaultAction + " ... returning: " + ICAaction);
return ICAaction;

If you activate the console in the browser's Developer Tools, you should see something like:

You can download the updated script.js here.