Secure Global Desktop Administration Guide > Applets > getUserName (framework applet)

getUserName (framework applet)

Syntax

String getUserName()

Description

The getUserName method returns the user's TFN name in the Secure Global Desktop datastore. This can be useful if you want to use JavaScript to control a user's Secure Global Desktop session.

By default, the framework applet, BootStrapShell resides in a frame called StateFrame, and has the name Tarantella Framework. From a document in the same browser window as the framework applet, you can call the getUserName method with the following JavaScript code:

top.StateFrame.document.applets["Tarantella Framework"].getUserName()

Examples

<SCRIPT LANGUAGE="JavaScript">

function whoAmI() {
   alert("You are " + top.StateFrame.document.applets["Tarantella Framework"].getUserName());
}

</SCRIPT>

<FORM>
   <INPUT TYPE=button VALUE="Who am I?" onclick="whoAmI()">
</FORM>

This example adds a button beneath the links on users' webtops. When a user clicks this button, Secure Global Desktop displays a short message indicating the current user's TFN name.

Add the code to the HTML document containing the webtop tray applet (left.html, in the sco/tta/standard webtop theme), after the TTAAPPLET declaration.

Note This example assumes you are using the sco/tta/standard webtop theme. If you're using another theme, with different frame names and layouts, or different applet names, you'll need to modify the lines that invoke the getUserName method to access the login applet used by your new theme.

Related topics