Highlighted
Contributor.
Contributor.
319 views

How a page’s JavaScript code can detect if the page is running under true client?

Hi

In our JavaScript application, we need to detect if the page is running under TrueClient. Then we can use the flag to do special application logic initialization for TrueClient.

I expect there must be a property added to the Window object that I can test. Something like this:

If(window.IsTrueCluent === true) {

               //Do something;

}

How a page’s JavaScript code can detect if the page is running under true client?

Thank you

JP

 

0 Likes
1 Reply
Highlighted
Contributor.
Contributor.

Re: How a page’s JavaScript code can detect if the page is running under true client?

Hi,

Since TruClient tries to be as non-intrusive as possible, there is no official way to detect whether a page is running under TruClient or not. Nevertheless, you can achieve this functionality by using the AUT API, which gives you access to the page’s JavaScript code. This way you can add a property on the window object as you desire. Here is how:

  1. Add an “Evaluate JavaScript” step in your script.
  2. In the argument section enter the following code:
    window.isTruClient = true;

In case you need to do this after each navigation or a page refresh, you may consider creating a new function for this step and call it when required. If you need to do this for multiple scripts, then it's better to export this function to a global library, and import it across your scripts.

Best Regards,

Eyal Babagani

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.