Customizing the virtual viewer by using the JavaScript API

IBM Daeja ViewONE JavaScript APIs. These APIs offer an alternative mechanism for developers to configure and control IBM Daeja ViewONE Virtual.

Before you begin

You can review JavaScript parameters in the JavaScript API reference section.

About this task

While the simple HTML parameters provide a powerful way of customizing and configuring IBM Daeja ViewONE, you can use the JavaScript API when a more dynamic operation is required. For example, you might use the JavaScript APIs to configure parameters during the operation of IBM Daeja ViewONE or to change a document without reloading a web page or to rotate a page.

Additionally, traditional web-viewing applications habitually reload a web page to view or change the currently viewed image or document. To avoid refreshing the web page, you can use the JavaScript operations to open and close documents or images. This feature can result in significant performance improvements because delays that are caused by refreshing the page and reloading and restarting the viewer are avoided.

You set the server properties in the parameter configuration file, servlet-name.properties. The name of the parameter configuration file is specified in the web.xml file. This file is deployed on the web server with the application itself, for example, in the WEB-INF folder.

Use the following example format for adding a parameter to a parameter configuration file:
ViewONE.name(int, other)

The examples might be used within functions of a JavaScript program or directly as event handlers to such things as buttons and hyperlinks.

Procedure

To use the JavaScript methods:

  1. Replace name with the method name and int, other with any required value.
    Important: Except for file names and hyperlink addresses, all parameters are not case-sensitive. However, some browsers are case-sensitive. Therefore, you must enter method names as shown to ensure that the methods are called correctly.
  2. Use the internet URL address format to specify file names and hyperlink addresses, for example, http://mysite/myimage.tif. If any part of the address before myimage.tif is not included, then the viewer assumes a base address that is the same as the viewer location (the codebase).

Results

Important: Some JavaScript methods are disabled by default and can be enabled only by setting the JavaScriptExtensions or annotationJavaScriptExtensions HTML parameter to true as follows:
<param name="JavaScriptExtensions" value="true">
<param name="annotationJavaScriptExtensions" value="true">

These methods are disabled to prevent unauthorized users from attempting to manipulate IBM Daeja ViewONE through JavaScript methods to obtain access to secure information, documents, and annotations.

The methods that are restricted in this manner are clearly marked within this document.