Stop a user from navigating away from Citrix StoreFront pages

I recently had a conversation with someone around whether or not it was possible to use AppSense Environment Manager stop a user from navigating away from a Citrix StoreFront page. Internet Explorer was the browser in use so that kept the scope quite narrow.

First thoughts were to use a Process Stopped trigger. Unfortunately though IE spawns hidden processes that later close without the user knowing. This means that we were randomly getting IE loading again with the possibility of going into an infinite loop. Not good!!

Back to the drawing board, this time we decided to look at the Lockdown Tool. Could that achieve what we needed…

Well, the granularity isn’t enough to allow us to disable the Close Tab button only one tab. But it did prove that using Lockdown we would be able to remove all capabilities from the user to close the tab or window (apart from using the taskbar). With that in mind proxy rules could go in place to stop the navigating anywhere else. All good so far, but a little onerous on management as we’s need to kill off GUI item, menu items and shortcut keys. At least it’s an option though.

But could we do any better…

Looking at the code for Citrix StoreFront showed that there was a file called custom.script.js in the contrib folder. This allows us to put our own functions and hooks into the website. With that in mind we can create a hook to the beforeunload event and interact with the user before the page disappears. More information in this event can be found here.

Now we can prompt the user if they are sure they want to navigate away. That puts us a whole lot further forward now. We can alert the user when they are moving away with a custom message. The final custom.script.js file can be found here. This even kicks in when the taskbar is used to close the application. There’s only one problem though… The Leave this page button will still allow users to close the page. Now, in this environment, we know that we really only want users on this page. This is where Environment Manager comes in again. Lockdown to the rescue… Now we can hide the button using Lockdown. Because of the granular nature of Environment Manager we are able to make this lockdown apply only for certain users, connection types, devices etc.

Screenshots of the final solution below…

Before Environment Manager Lockdown
Before Environment Manager Lockdown
After Environment Manager Lockdown
After Environment Manager Lockdown