OpenAM 13 – Getting contextPath while customizing DataStore1.html

This topic has 1 reply, 1 voice, and was last updated 2 years, 5 months ago by l.scorcia.

  • Author
  • #27580

    Hello everyone,
    I am trying to customize the UI of our OpenAM 13 setup by editing DataStore1.html and some other html template and I need to build an absolute url to OpenAM (i.e. current URI is, I need to get, in order to pass it to the RelayState parameter of spSSOInit.jsp .

    Now, this is not impossible to get using the various window.location properties, but I was trying to keep it independent of the actual deployment, so I was wondering if there is a direct way to get the current protocol+host+port+contextPath from some property available to the UI via Handlebars or global variables or something else. If it were a JSP I would just use ‘${pageContext.request.scheme}://${pageContext.request.serverName}:${pageContext.request.serverPort}${pageContext.request.contextPath}’, but here we’re in a static html template and I don’t know if there is some way to get the required pieces, especially the contextPath. Do you have any suggestions?

    Thanks in advance,


    Well, in case anyone else need this in the future, I haven’t been able to get it using Handlebars’ data but it turns out it can actually be done in javascript using the XUI scripts!

      function (constants) { 

    This returns the application context, i.e. for https :// (spaces added for antispam filter) this returns openam .
    The scheme/host/port can also be retrieved using a similar snippet:

      function (router) { 

    returns http :// (spaces added for antispam filter).

    Have a nice day,

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

©2022 ForgeRock - we provide an identity and access platform to secure every online relationship for the enterprise market, educational sector and even entire countries. Click to view our privacy policy and terms of use.

Log in with your credentials

Forgot your details?