Redirect the application end

The MySessionEndWidget widget, provided as part of the default customization, allows you to specify a redirection URL.

Important: The customized files for the MySessionEndWidget widget were introduced with GWC-JS 1.00.20.

The MySessionEndWidget customization extends the SessionEndWidget to automatically redirect the user to a specified URL after a set number of milliseconds.

Updating the MySessionEndWidget customization

Edit MySessionEndWidget.js to change the redirect URL or the delay before redirection. Comments in the widget identify where these changes can be made.

To change the redirect URL, replace http://www.google.com with the desired URL:
// update redirection link url of the template
var redirectionLink = this._element.getElementsByClassName("redirectionLink")[0];
redirectionLink.title = i18n.t("mycusto.session.redirectionText");
var url = "http://www.google.com";
redirectionLink.href = url;
To change the length of the delay before redirecting, replace 10000 with the number of milliseconds to delay:
var modelHelper = new cls.ModelHelper(this);
// Launch the redirection after a delay of 10 seconds
// To remove the delay, remove the setTimeout, but keep the 'if' block
setTimeout(function () {
    // check if an application is running in the current session before reloading
    if(!modelHelper.getCurrentApplication()) {
        window.location = url;
    }
}.bind(this), 10000); // 10000ms
To eliminate the delay, remove the setTimeout function code surrounding window.location = url:
var modelHelper = new cls.ModelHelper(this);
    // check if an application is running in the current session before reloading
    if(!modelHelper.getCurrentApplication()) {
        window.location = url;
    }
Note: This does not completely halt the display of the end page. The ending page flashes briefly, as redirection occurs only after the ending page displays.

Change the redirection message

The message displayed prior to the redirection is based on the value of the redirectionText variable in the language-specific .json files, located in the locales directory of the customization project. To update the message, edit each of the language-specific files.

Using the MySessionEndWidget widget

The MySessionEndWidget is provided as part of the default customization. You either use the default customization, or you can copy the three widget files (.js, .tpl.html, and .scss) to the appropriate directories in your customization project.

After making any changes to a widget file, rebuild your customization project using the grunt command.