Storefront 2.6 and Windows 10 Edge Browser

by Sam Jacobs, CTP

If you’ve been following Feng Huang’s blog on customizing Receiver, you’ve probably seen StoreFront 3.0 and Windows 10 Edge Browser. In it, Feng explains how StoreFront 3.0 has been given the smarts to allow you to use the native Receiver with Edge.
What if you are still running StoreFront 2.6 (or 2.5)? Since Edge cannot run the ActiveX controls necessary for client detection, only the HTML5 Receiver would be used (see: Receiver Feature Matrix for HTML5 Receiver limitations).

This post will use a slightly modified version of another one of Feng’s posts – Preparing for NPAPI Being Disabled by Google Chrome – to give you the ability to use the native Receiver with Edge and StoreFront 2.x.

In that post, Feng discusses how to:

  • Disable the prompt to install the Receiver
  • Provide a permanent link for downloading the Receiver
  • Provide a link to switch between the native (full) Receiver and the HTML5 Receiver (referred to as the ‘Lite’ version of the Receiver).


However, the modifications discussed in the post are specific to Chrome. With just a bit of tweaking, we can add the above features to work for any browser.

We begin by adding the following strings to custom.wrstrings.en.js and a localized version for every language you need to support to custom.wrstrings.[language].js. 

    DownloadReceiver: 'Install full Receiver',
    DownloadReceiverToolTip: 'Install the full version of Receiver on your PC',
    ChangeToLiteClient: "Use lite version of Receiver",
    ChangeToLiteClientToolTip: "You are currently using the full version of Receiver to launch applications. Click here to change to use the lite version. The lite version should be used for Chromebooks, and anytime the full version of the Receiver can not be installed.",
    ChangeToFullClient: "Change to full Receiver",
    ChangeToFullClientToolTip: "You are currently using the lite version of Receiver to launch applications. Click here to change to use the full version.",

Next, we need to add the code below to custom.script.js (in the contrib folder of the StoreWeb site).

$(document).ready(function () {

    // 10-15-2015 - sj - disable the client download prompt for ALL browsers
    function endPluginAssistant() {
        CTXS.setCookie(CTXS.COOKIE_PLUGIN_ASSISTANT_STATE, CTXS.PLUGIN_ASSISTANT_DONE);
        if (CTXS.getCookie(CTXS.COOKIE_PLUGIN_ASSISTANT_STATE) === null) {
            CTXS.displayTemplate("CookiesAreDisabled");
        } else {
            CTXS.Application.displaySpinner();
            CTXS.Events.publish(CTXS.Events.pluginAssistant.done);
        }
    };
    var origInit = CTXS.PluginDetection.init;
    CTXS.PluginDetection.init = function() {
        endPluginAssistant();
    }

    // 10-15-2015 - sj - add links for downloading the Receiver and switching between clients
    $.ctxs.ctxsUserMenu.prototype._origGenerateDropDownMenu = $.ctxs.ctxsUserMenu.prototype._generateDropDownMenu;
    $.ctxs.ctxsUserMenu.prototype._generateDropDownMenu = function(ddMenu) {
        var self = this;
        var $mBody = ddMenu.children(".usermenu-body");
        if ((CTXS.ClientInfo.isWindows() || CTXS.ClientInfo.isMacOSX())) {
            var clientUrl = CTXS.ClientInfo.isWindows() ? CTXS.Config.pluginAssistant.win32.path : CTXS.Config.pluginAssistant.macOS.path;
            $mBody.append('

'.format(clientUrl));
        }

        if ((CTXS.Config.pluginAssistant.html5.enabled == CTXS.Html5Client.ENABLED_FALLBACK) && (! CTXS.Html5Client.mustUseHtml5Client())) {
    CTXS.Html5Client.usingHtml5Client = function (flag) {
                return (CTXS.getCookie("CtxsUseHtml5Client") == "true");
            };
            var label = (CTXS.getCookie("CtxsUseHtml5Client") == "true") ? $.localization.string('ChangeToFullClient') : $.localization.string('ChangeToLiteClient');
            var title = (CTXS.getCookie("CtxsUseHtml5Client") == "true") ? $.localization.string('ChangeToFullClientToolTip') : $.localization.string('ChangeToLiteClientToolTip');
            $mBody.append('

‘ + label + ‘

')
                .find('#userdetails-changeclient')
                .click(function(event) {
                    if (CTXS.getCookie("CtxsUseHtml5Client") == "true") {
                        CTXS.setCookie("CtxsUseHtml5Client", "false", true);
                        $('#userdetails-changeclient').text($.localization.string('ChangeToLiteClient'));
                        $('#userdetails-changeclient').attr('title', $.localization.string('ChangeToLiteClientToolTip'));
                    } else {
                        CTXS.setCookie("CtxsUseHtml5Client", "true", true);
                        $('#userdetails-changeclient').text($.localization.string('ChangeToFullClient'));
                        $('#userdetails-changeclient').attr('title', $.localization.string('ChangeToFullClientToolTip'));
                    }
                    event.preventDefault();
                });
        }
        self._origGenerateDropDownMenu(ddMenu);
    };
});

The code above adds the following links to the dropdown next to the user’s name:

By default, the Receiver will be downloaded from citrix.com. To deploy Receiver from StoreFront, see Section 2.2 here: Customize and Deploy Citrix Receiver.

If you hover over the second option:

Click the option to switch to the HTML5 (“lite”) Receiver.

Click the menu option once again …

… and you’re back to using the native Receiver.

Leave a Reply