Issue
Is it possible to determine if a TGML graphic is being run in Workstation or Webstation?
Environment
TGML Graphics Editor 1.1.X
Vista 5.1.X Workstation
TacWebApps 5.1.X (Webstation)
Cause
There are differences in the rendering of graphics between Workstation and Webstation. Sometimes this leads to the necessity of creating two sets of components depending on where the graphics will be presented. By being able to programmatically determine the environment, one set of components can be used regardless of the presentation, reducing engineering time.
Resolution
- Create a document-level script tag that runs OnDocumentLoad.
-
Determine the current Vista version (and keep potential future upgrades in mind as well). The implementation of the property changed in an upgrade from Vista 5.1.4 to Vista 5.1.5.
-
If the system is Vista version 5.1.4 and prior, use the following function:
if (Packages.java.lang.System.getProperty("browser") == "ActiveX Scripting Host")
If the statement is true, then the graphic is being run in Workstation. -
If the system is Vista version 5.1.5 and later, use the following function
if (Packages.java.lang.System.getProperty("java.runtime.name") == "IKVM.NET")
If the statement is true, then the graphic is being run in Workstation.
-
The following script can be run for any version of Vista 5.
/*
returns what browser Tgml is viewed in (Workstation==false,Webstation/Webserver==true)
*/
var getBrowserType = function() {
var browser = false; // initiates browser indication variable as Webstation/Webserver
if (Packages.java.lang.System.getProperty("browser") != null) { // checks Vista version
// evaluated for Vista is 5.1.4 or earlier
if (Packages.java.lang.System.getProperty("browser") == "ActiveX Scripting Host") {
browser = false; // indicates variable as Workstation
} else {
browser = true; // indicates variable as Webstation/Webserver
}
} else {
// evaluated for Vista 5.1.5 or later
if (Packages.java.lang.System.getProperty("java.runtime.name") == "IKVM.NET") {
browser = false; // indicates variable as Workstation
} else {
browser = true; // indicates variable as Webstation/Webserver
}
}
return browser; // returns browser indication
}
-
If the system is Vista version 5.1.4 and prior, use the following function: