Add a dynamic header

To add a static header add the following to script.js:

$('#CustomTop').html("Important announcement");
<!--NeedCopy-->

The disadvantage of this technique is that the Citrix app caches scrip.css so if you make any changes to the text users will not see them until the app next refreshes its cache.

The alternative is to dynamically load the text to display from the server every time the page loads. This ensures any changes you make take effect immediately but this also comes with a small performance cost.

Firstly add a file status.txt to the directory customweb containing the text or an HTML snippet you wish to display in the disclaimer. In this example the file contains the text “Server UP”. It’s important to use customweb rather than custom as customweb is not cached on the client.

Next, update script.js to load the contents of the file and update the page at a suitable point. If it is called too soon, then this can cause problems in native clients, because the script runs before the configuration has been fully loaded. A good time for this sort of action is beforeDisplayHomeScreen (but if you want to display content on the login page, then use beforeLogin instead).

// Remember whether the content has been cached yet so it is only done once
var fetchedContent=false;

function doFetchContent(callback) {
    if(!fetchedContent) {
        fetchedContent = true;
        // Request status.txt and if successful, update the banner
        CTXS.ExtensionAPI.proxyRequest({
        url: "customweb/status.txt",
        success: (txt) => {document.getElementById("customTop").innerText = txt}});
    }
    callback();
}
CTXS.Extensions.beforeDisplayHomeScreen = doFetchContent;
<!--NeedCopy-->

To make it more prominent, add some formatting to custom/style.css

#customTop
{
    text-align:center;
    background-color: yellow;
    font-size:30px;
    height: 40px;
}
<!--NeedCopy-->

After adding the customization code, here is what it looks like:

Screenshot of page with header

Add a dynamic header

In this article