4.0 HTML Samples

4.1 HTML Code Samples

In Reflection for the Web, lists of session links are provided in a login applet. After a user logs in, a list of links to their assigned sessions opens.

If you want to create a custom web page for your users instead of using the provided links list, log in as a user (not as an administrator) to whom sessions are assigned, and then right-click a link to copy the URL to the clipboard. You can then paste the URL into your customized web page.

4.1.1 About HTML code samples

In Reflection for the Web, you have several options for emulator session files. The Manage Sessions interface (in the MSS Administrative Console) provides an easy way to create sessions with most of the basic functionality you need. Session files defined here are dynamically generated upon user request and provide full security and access control functionality.

You can also save a customizable form of session files in the deploy folder. Files in this folder cannot be edited in Manage Sessions, but they can be assigned to users in the Assign Users & Groups panel. These session files provide the same security and access control as sessions created using Manage Sessions.

To customize Reflection for the Web session files:

  1. Use a text editor to create the basic HTML and applet tag for the session.

    You can copy the session HTML and paste it into a text file. Go to Manage Sessions - Edit Session panel. Click ADVANCED and scroll to View Session HTML.

  2. Add custom HTML, JavaScript, or Reflection API code to the file.

  3. Give the file a name with an .html extension and save it to MSSData/deploy.

  4. Place any image files or other files called by the session html file in the session folder.

You can also save the session HTML to the session folder. However, files in this folder cannot be assigned to users and do not benefit from Management and Security Server's access control features.

The samples in this section provide examples of sessions that can be stored in the deploy folder. Modifications using HTML and JavaScript extend the functionality provided by the basic session files created using Manage Sessions.

NOTE:Micro Focus permits you to edit, manipulate, and change graphics, text, HTML code, JavaScript code, Java code, and other code in Reflection for the Web samples. The sample code and graphics are for use solely with deploying your internal Reflection web pages and for no other purpose. Micro Focus has no warranty, obligation, or liability for the contents of the samples.

Troubleshooting Tip

The sample pages are available so that you can view the page and copy the sample code to a new HTML file. If the sample code is not formatted correctly after you paste it into your text editor, try reselecting the sample code, making sure that you extend your selection to the blank line after the end of the sample.

Some browsers, such as Internet Explorer, do not copy all of the code formatting unless an ending paragraph mark is also selected. You can ensure that the paragraph mark is included in the selection by including the blank line after the last line of code.

4.1.2 Available HTML code samples

See these HTML code samples for running terminal sessions and associated tasks.

NOTE:Although the static session feature is still supported, that legacy behavior is not recommended. Newer ways of launching Reflection for the Web applets, such as dynamic sessions and the Reflection for the Web Launcher, should be looked at before creating further static sessions.

More advanced functionality is available using the Reflection API with JavaScript, VBScript, or Java. See the API section for more information.

Running a terminal session with printer emulation

You can easily run two sessions from a single page. The best way to set up this kind of multiple emulation session is to follow these steps:

  1. Create the first session using the Manage Sessions panel in the MSS Administrative Console.

  2. On the Add New Session panel, scroll to and click ADVANCED.

    Scroll to View Session HTML and copy the code.

  3. Paste the HTML code into a text editor.

  4. Return to Manage Sessions and create the second session.

  5. In the View Session HTML box, select just the applet tag and its parameters. Copy this text. (You can also copy the entire text to the clipboard, paste it into a second text file, and then copy just the applet text from that file.)

  6. Paste the second applet into the text file containing the first applet and save the results in the deploy folder as [session_name.html].

Sample code

This sample HTML code demonstrates how to start a standard IBM 3270 session with the IBM 3270 printer running in the background. The applet launches the terminal session in a separate window, and the code is designed for Internet Explorer 11 with the Oracle Java browser plug-in.

The first applet in the sample loads a 3270 host session named myHost on port 23, in the browser window. The second applet opens a 3270 printer session on a device named myDevice on port 23, running in its own window. The two sessions are associated using the tnAssociation parameter.

Replace the 1.2.3.4 value with the server name or server IP address of the MSS server.

<html>
<head>
<title>IBM 3270 with Printer Session</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="charset" content="iso-8859-1">
</head>
<body>
<h3>3270</h3>
<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    type="application/x-java-applet"
    codebase="http://java.sun.com/update/1.7.0/jinstall-7u13-windows-i586.cab"
    name="IBM3270Frame"
    width="600" 
    height="400" 
    mayscript="true">
    <param name="debug" value="false">
    <param name="code" value="com.wrq.rweb.Launcher">
    <param name="codeBase" value="http://1.2.3.4/rweb-client/ex">
    <param name="ftpenabled" value="false">
    <param name="prefsName" value="IBM3270Frame">
    <param name="archive" value="http://1.2.3.4/rweb-client/ex/Launcher.jar">
    <param name="showStatusLine" value="true">
    <param name="title" value="Reflection for the Web - IBM3270">
    <param name="logFilter" value="15">
    <param name="activationfiles" value="">
    <param name="frame" value="true">
    <param name="securityEnabled" value="false">
    <param name="encryptStream" value="false">
    <param name="hostURL" value="tn3270e://myHost:23">
    <param name="deviceName" value="myDevice">
    <param name="tnAssociation" value="assocString">
    <param name="autoDetect" value="true">
    <param name="launcher.sessions" value="IBM3270">
        <embed type="application/x-java-applet"
            name="IBM3270Frame"
            width="600" 
            height="400" 
            pluginspage="http://www.java.com/"
            mayscript="true"
            debug="false"
            code="com.wrq.rweb.Launcher"
            codeBase="http://1.2.3.4/rweb-client/ex"
            ftpenabled="false"
            prefsName="IBM3270Frame"
            archive="http://1.2.3.4/rweb-client/ex/Launcher.jar"
            showStatusLine="true"
            title="Reflection for the Web - IBM3270Frame"
            logFilter="15"
            activationfiles=""
            frame="false"
            securityEnabled="false"
            encryptStream="false"
            hostURL="tn3270e://myHost:23"
            deviceName="myDevice"
            tnAssociation="assocString"
            autoDetect="true"
            launcher.sessions="IBM3270">
        </embed>
</object>

<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    type="application/x-java-applet"
    codebase="http://java.sun.com/update/1.7.0/jinstall-7u13-windows-i586.cab"
    name="IBM3287Device"
    mayscript="true">
    <param name="debug" value="false">
    <param name="code" value="com.wrq.rweb.Launcher">
    <param name="codeBase" value="http://1.2.3.4/rweb-client/ex">
    <param name="ftpenabled" value="false">
    <param name="prefsName" value="IBM3287Device">
    <param name="archive" value="http://1.2.3.4/rweb-client/ex/Launcher.jar">
    <param name="showStatusLine" value="true">
    <param name="title" value="Reflection for the Web - IBM3287Device">
    <param name="logFilter" value="15">
    <param name="activationfiles" value="">
    <param name="frame" value="true">
    <param name="securityEnabled" value="false">
    <param name="encryptStream" value="false">
    <param name="hostURL" value="tn3270e://myHost:23">
    <param name="promptForDeviceName" value="false">
    <param name="tnAssociation" value="assocString">
    <param name="tn3270eConnectType" value="0">
    <param name="autoDetect" value="true">
    <param name="launcher.sessions" value="IBM3287">
        <embed type="application/x-java-applet"
            name="IBM3287Device"
            pluginspage="http://www.java.com/"
            mayscript="true"
            debug="false"
            code="com.wrq.rweb.Launcher"
            codeBase="http://1.2.3.4/rweb-client/ex"
            ftpenabled="false"
            prefsName="IBM3287Device"
            archive="http://1.2.3.4/rweb-client/ex/Launcher.jar"
            showStatusLine="true"
            title="Reflection for the Web - IBM3287Device"
            logFilter="15"
            activationfiles=""
            frame="true"
            securityEnabled="false"
            encryptStream="false"
            hostURL="tn3270e://myHost:23"
            promptForDeviceName="false"
            tnAssociation="assocString"
            tn3270eConnectType="0"
            autoDetect="true"
            launcher.sessions="IBM3287">
        </embed>
</object>

</body>
</html>

Related topic

Dynamically allocating ports and assigning device names

For Internet Explorer 11 with the Oracle Java browser plug-in

These two samples demonstrate how to dynamically:

  • Specify a port number in a terminal session. The applet launches the session in a separate window.

  • Specify a device name or pool in an IBM 3270 Printer session. For example, you could modify this code to assign a device name to specific users based on the user name. The applet launches the terminal session in a separate window. Devices are used in IBM emulation sessions only.

To start a terminal session using this sample page

  1. Copy the sample JavaScript code below to an HTML file.

  2. In the first block of JavaScript code, add custom code to determine the port number or device name you want to use. The inserted code should return the string (in quotes) of the port or device name to use.

  3. In the hostURL parameter, replace myHost with the name or URL of the host to which you want to connect.

  4. To specify a port number: In the launcher.sessions parameter, replace session type with the appropriate session type indicator:

    Session type

    Indicator

    HP

    HP

    IBM 3270

    IBM 3270

    IBM 3270 printer

    IBM3287

    IBM 5250

    IBM 5250

    IBM 5250 printer

    IBM 3812

    IBM AS/400 data transfer

    IBM 5250Xfer

    VT

    VT

    To specify a device name, see Sample code to assign device names.

  5. Save the file in the deploy folder.

Sample code to allocate port numbers
<script language="JavaScript">
<!--
// Add JavaScript code here to determine the port number.
function getPort()
{
   return "23";
}
// Get the value for the port and insert it into the applet parameter.
port = getPort();

document.writeln( '<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"' );
document.writeln( '    type="application/x-java-applet"' );
document.writeln( '    codebase="http://java.sun.com/update/1.7.0/jinstall-7u13-windows-i586.cab"' );
document.writeln( '    name="Dynamic_Port"' );
document.writeln( '    width="0"' );
document.writeln( '    height="0"' );
document.writeln( '    mayscript="true">' );
document.writeln( '    <param name="debug" value="true">' );
document.writeln( '    <param name="code" value="com.wrq.rweb.Launcher">' );
document.writeln( '    <param name="codeBase" value="http://1.2.3.4/rweb-client/ex">' );
document.writeln( '    <param name="ftpenabled" value="false">' );
document.writeln( '    <param name="prefsName" value="Dynamic_Port">' );
document.writeln( '    <param name="archive" value="http://1.2.3.4/rweb-client/ex/Launcher.jar">' );
document.writeln( '    <param name="showStatusLine" value="true">' );
document.writeln( '    <param name="title" value="Reflection for the Web - Dynamic_Port">' );
document.writeln( '    <param name="logFilter" value="15">' );
document.writeln( '    <param name="activationfiles" value="">' );
document.writeln( '    <param name="frame" value="true">' );
document.writeln( '    <param name="securityEnabled" value="false">' );
document.writeln( '    <param name="encryptStream" value="false">' );
document.writeln( '    <param name="hostURL" value="tn3270://MyHost:' + port + '">' );
document.writeln( '    <param name="menuType" value="advanced">'' );
document.writeln( '    <param name="autoDetect" value="true">' );
document.writeln( '    <param name="launcher.sessions" value="IBM3270">' );
document.writeln( '        <embed type="application/x-java-applet"' );
document.writeln( '            name="IBM3270"' );
document.writeln( '            pluginspage="http://www.java.com/"' );
document.writeln( '            mayscript="true"' );
document.writeln( '            debug="false"' );
document.writeln( '            code="com.wrq.rweb.Launcher"' );
document.writeln( '            codeBase="http://1.2.3.4/rweb-client/ex"' );
document.writeln( '            ftpenabled="false"' );
document.writeln( '            prefsName="Dynamic_Port"' );
document.writeln( '            archive="http://1.2.3.4/rweb-client/ex/Launcher.jar"' );
document.writeln( '            showStatusLine="true"' );
document.writeln( '            title="Reflection for the Web - Dynamic_Port"' );
document.writeln( '            logFilter="15"' );
document.writeln( '            activationfiles=""' );
document.writeln( '            frame="true"' );
document.writeln( '            securityEnabled="false"' );
document.writeln( '            encryptStream="false"' );
document.writeln( '            hostURL="tn3270://MyHost:' + port + '"' );
document.writeln( '            menuType="advanced"' );
document.writeln( '            autoDetect="true"' );
document.writeln( '            launcher.sessions="IBM3270">' );
document.writeln( '        </embed>' );
document.writeln( '</object>' );

// End of comment -->
</script>
Sample code to assign device names
<script language="JavaScript">
<!-- Comment for non-JavaScript browsers.  
// Add JavaScript code here to determine the device name.
    function getDeviceName()
    {
        return "myDevicePool";
    }

// Get the value for deviceName and put it into the applet parameter.
device = getDeviceName();
// In the hostURL parameter, replace myHost with a valid host name or URL.

document.writeln( '<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"' );
document.writeln( '    type="application/x-java-applet"' );
document.writeln( '    codebase="http://java.sun.com/update/1.7.0/jinstall-7u13-windows-i586.cab"' );
document.writeln( '    name="IBM3287Device"' );
document.writeln( '    width="0"' );
document.writeln( '    height="0"' );
document.writeln( '    mayscript="true">' );
document.writeln( '    <param name="debug" value="true">' );
document.writeln( '    <param name="code" value="com.wrq.rweb.Launcher">' );
document.writeln( '    <param name="codeBase" value="http://1.2.3.4/rweb-client/ex">' );
document.writeln( '    <param name="ftpenabled" value="false">' );
document.writeln( '    <param name="prefsName" value="IBM3287Device">' );
document.writeln( '    <param name="archive" value="http://1.2.3.4/rweb-client/ex/Launcher.jar">' );
document.writeln( '    <param name="showStatusLine" value="true">' );
document.writeln( '    <param name="title" value="Reflection for the Web - IBM3287Device">' );
document.writeln( '    <param name="logFilter" value="15">' );
document.writeln( '    <param name="activationfiles" value="">' );
document.writeln( '    <param name="frame" value="true">' );
document.writeln( '    <param name="securityEnabled" value="false">' );
document.writeln( '    <param name="encryptStream" value="false">' );
document.writeln( '    <param name="deviceName" value="' + device + '">' );
document.writeln( '    <param name="hostURL" value="tn3270://MyHost">' );
document.writeln( '    <param name="menuType" value="advanced">'' );
document.writeln( '    <param name="autoconnect" value="true">' );
document.writeln( '    <param name="autoDetect" value="true">' );
document.writeln( '    <param name="launcher.sessions" value="IBM3287">' );
document.writeln( '        <embed type="application/x-java-applet"' );
document.writeln( '            name="IBM3270"' );
document.writeln( '            pluginspage="http://www.java.com/"' );
document.writeln( '            mayscript="true"' );
document.writeln( '            debug="false"' );
document.writeln( '            code="com.wrq.rweb.Launcher"' );
document.writeln( '            codeBase="http://1.2.3.4/rweb-client/ex"' );
document.writeln( '            ftpenabled="false"' );
document.writeln( '            prefsName="IBM3287Device"' );
document.writeln( '            archive="http://1.2.3.4/rweb-client/ex/Launcher.jar"' );
document.writeln( '            showStatusLine="true"' );
document.writeln( '            title="Reflection for the Web - IBM3287Device"' );
document.writeln( '            logFilter="15"' );
document.writeln( '            activationfiles=""' );
document.writeln( '            frame="true"' );
document.writeln( '            securityEnabled="false"' );
document.writeln( '            encryptStream="false"' );
document.writeln( '            deviceName="' + device + '"' );
document.writeln( '            hostURL="tn3270://MyHost"' );
document.writeln( '            menuType="advanced"' );
document.writeln( '            autoconnect="true"' );
document.writeln( '            autoDetect="true"' );
document.writeln( '            launcher.sessions="IBM3287">' );
document.writeln( '        </embed>' );
document.writeln( '</object>' );


// End of comment -->
</script>

Related topic

Disabling browser navigation

This sample JavaScript code demonstrates how to start a standard session in a new window with the browser navigation controls disabled in Internet Explorer.

To start a terminal session using this sample

  1. Copy the sample JavaScript code below to an HTML file.

  2. In the hostURL parameter, replace myHost with the name or URL of the host to which you want to connect. If you choose not to connect automatically, delete the hostURL and autoconnect parameters.

  3. Save the file in the deploy folder.

Sample code
<script language="JavaScript">
<!-- Comment for non-JavaScript browsers.

targetwin = window.open( "", "IBM3270Applet", "status=yes, width=650, height=550" );
targetdoc = targetwin.document;

// Use the "with (object)" statement to simplify the following lines.
with ( targetdoc ) {
    writeln( '<html>' );
    writeln( '<body>' );
    writeln( '' );
    writeln( '<h1>Reflection for IBM 3270</h1>' );
    writeln( '<object classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"' );
    writeln( '    type="application/x-java-applet"' );
    writeln( '    codebase="http://java.sun.com/update/1.7.0/jinstall-7u13-windows-i586.cab"' );
    writeln( '    name="IBM3270"' );
    writeln( '    width="600"' );
    writeln( '    height="400"' );
    writeln( '    mayscript="true">' );
    writeln( '    <param name="debug" value="true">' );
    writeln( '    <param name="code" value="com.wrq.rweb.Launcher">' );
    writeln( '    <param name="codeBase" value="http://1.2.3.4/rweb-client/ex">' );
    writeln( '    <param name="ftpenabled" value="false">' );
    writeln( '    <param name="prefsName" value="IBM3270">' );
    writeln( '    <param name="archive" value="http://1.2.3.4/rweb-client/ex/Launcher.jar">' );
    writeln( '    <param name="showStatusLine" value="true">' );
    writeln( '    <param name="title" value="Reflection for the Web - IBM3270">' );
    writeln( '    <param name="logFilter" value="15">' );
    writeln( '    <param name="activationfiles" value="">' );
    writeln( '    <param name="frame" value="false">' );
    writeln( '    <param name="securityEnabled" value="false">' );
    writeln( '    <param name="encryptStream" value="false">' );
    writeln( '    <param name="hostURL" value="tn3270://myHost:23">' );
    writeln( '    <param name="menuType" value="advanced">'' );
    writeln( '    <param name="autoconnect" value="true">' );
    writeln( '    <param name="shortcutMenu" value="true">' );
    writeln( '    <param name="autoDetect" value="true">' );
    writeln( '    <param name="launcher.sessions" value="IBM3270">' );
    writeln( '        <embed type="application/x-java-applet"' );
    writeln( '            name="IBM3270"' );
    writeln( '            pluginspage="http://www.java.com/"' );
    writeln( '            mayscript="true"' );
    writeln( '            debug="false"' );
    writeln( '            code="com.wrq.rweb.Launcher"' );
    writeln( '            codeBase="http://1.2.3.4/rweb-client/ex"' );
    writeln( '            ftpenabled="false"' );
    writeln( '            prefsName="IBM3270"' );
    writeln( '            archive="http://1.2.3.4/rweb-client/ex/Launcher.jar"' );
    writeln( '            showStatusLine="true"' );
    writeln( '            title="Reflection for the Web - IBM3270"' );
    writeln( '            logFilter="15"' );
    writeln( '            activationfiles=""' );
    writeln( '            frame="false"' );
    writeln( '            securityEnabled="false"' );
    writeln( '            encryptStream="false"' );
    writeln( '            hostURL="tn3270://myHost:23"' );
    writeln( '            menuType="advanced"' );
    writeln( '            autoconnect="true"' );
    writeln( '            shortcutMenu="true"' );
    writeln( '            autoDetect="true"' );
    writeln( '            launcher.sessions="IBM3270">' );
    writeln( '        </embed>' );
    writeln( '</object>' );
    writeln( '' );
    writeln( '<form>' );
    writeln( '    <input type="button"  ');
    writeln( '           name="Close" ' );
    writeln( '           value="Close Window" ' );
    writeln( '           onClick="window.close()"> ');
    writeln( '</form>' );
    writeln( '' );
    writeln( '</body>' );
    writeln( '</html>' );
    close();     
}

// End of comment -->
</script>

Related topic