Tuesday, January 26, 2016

How to Change the Page Title in Citrix Receiver 3.x

During my consulting engagements, I'm always coming across little tips and tricks, which might benefit others in similar situations. Over the course of the coming months, as time allows, I hope to share some of those tips with the community. Feedback is always welcomed.

My first tip is rather a simple one, yet was something that was quite a bit frustrating. In earlier versions of StoreFront, you could change the page title by adding the following code snippet into the JavaScript override file (custom.script.js in the contrib directory):

$(document).ready(function() {
 document.title = "My page title";

For StoreFront 3.x, the above script would be placed in the file script.js in the custom directory. If you attempt to do the same thing in StoreFront 3.x, however, you will see your updated title for a fraction of a second, and then it gets replaced by the default text of Citrix Receiver. Obviously, something was being called after script.js.

My next step was to check ctxs.wrstrings.js in <store>web\scripts\<lang code>. This is the template file that you would use to override text string within StoreFront. For example, I would frequently change the StoreFront dropdown from:


To do so, I simply copy the following line from <store>web\scripts\en\ctxs.wrstrings.js:

ActivateReceiver: "Activate ...",

... and copy it to <store>web\custom\strings.en.js, changing the line to read:

ActivateReceiver: "Configure Receiver ...",

Before I continue, I must stress that you do not want to change the template file itself for two reasons. First of all, a StoreFront upgrade would wipe out your changes, and secondly, changes to the template file would not propagate to other servers in the StoreFront server group.
I was hoping to find a line that could be overridden for the page title, but unfortunately, could not find one that fit. Not ready to give up, I searched through the Receiver Customization Extensions and APIs to see if there was something that could help. I came across the afterDisplayHomeScreen() function. So, I added the following to the script.js file in the custom directory:

CTXS.Extensions.afterDisplayHomeScreen = function () {
    document.title = 'My page title';

Voila! It worked... sort of. While it did work for the StoreFront applications screen, the logon screen still reverted back to Citrix Receiver. At this point, I reached out to one of my StoreFront gurus, Feng Huang, who graciously provided me with the correct answer. While I was correct in assuming that I would need to add an override string, it wasn't a string that already existed in ctxs.wrstrings.js. I simply needed to add the following into strings.en.js:

AppStore: "My page title",

Problem solved! (and the afterDisplayHomeScreen() function was no longer needed)

1 comment:

  1. My family always say that I am killing my time here at net, however I know I am getting know-how all the time by reading thes nice articles. itunes store login