This is part 3/3 on customizing StoreFront Services “Receiver for Web” stores using JavaScript. In the first two we looked at how to hide apps and make them sticky.

Today we’ll look into Autolaunch, meaning an application starting automatically right after a user logs into the “Receiver for Web” Store.

With StoreFront Services 1.2, if you have a single resource of type “desktop” (this can be a XenApp hosted shared desktop or a XenDesktop-based desktop) assigned to a user, it will launch automatically upon logon.
This behavior can be disabled using the configuration files (see http://support.citrix.com/proddocs/topic/dws-storefront-12/dws-configure-wr-conf-file.html).

With this change, the solution presented in this article – which was originally published for StoreFront Services 1.1) is outdated – as long as you were looking to automatically start a desktop. If you are looking to start an application or other resource, read on.

Add the following lines right below line 2136 (“g.tag = a.replace(/\u3000/g, ” “)”) in our well-known “C:\wwwroot\Citrix\%Your_Web_Store_Name%\scripts\Default.htm.script.min.js” (of which we have made a backup copy and a more readable version using jsbeautifier before):

if (g.encodedName.indexOf(“notepad”) != -1) {
CTXS.launchResource(g);
}

Done!

Now, after every login, the application, desktop or resource with the name you specified in “%application_name%” will be started automatically. Note the following cave-ats:

    - Autolaunch will work for non-subscribed apps too (whereas the builtin desktop autolaunch does not)
    - If a user refreshes the page (without logging out and back in), the application will autolaunch (to change this would mean a lot more heavy customization of the JavaScript code, the builtin desktop autolaunch uses a custom cookie)