Controlling WAVE from a web browser

Most web browsers, such as Firefox or Mozilla, can use so-called helper or viewer applications. These are external applications that are invoked by the browser to present data in formats that (usually) are not supported by the browser directly. For example, browsers often use ghostscript to display PostScript data. It is possible to configure Mozilla and other web browsers so that WAVE can be used indirectly as a helper application.

By using wavescript as the helper application for viewing WFDB records, an already-running WAVE process can be made to open a record and an annotation set and to move to a specified location in the record. With this approach, it is not necessary to start a new WAVE process each time.

On most platforms, WAVE can be started automatically if it is not running already; under MS-Windows, however, you must start WAVE manually before using it as a browser helper application.

You can set up your browser to view files with the MIME type application/x-wavescript using wavescript. Some browsers, including Firefox, Mozilla, and Netscape, also allow you to specify that any URL with the .xws suffix should be handled by wavescript.

If you use Firefox, click on any .xws link (such as this one) and Firefox will open a dialog box asking what it should do.

Figure 3.6: Adding wavescript as a Firefox helper: step 1.
\begin{figure}\centerline{\epsfig{file=firefox-new-helper}}\end{figure}

Choose ``Open with'', click on ``Browse...'', and choose wavescript (usually in /usr/bin) in the file selection dialog, then check ``Do this automatically for files like this from now on.'' The dialog box will expand to include instructions for modifying your choice.

Figure 3.7: Adding wavescript as a Firefox helper: step 2.
\begin{figure}\centerline{\epsfig{file=firefox-new-helper2}}\end{figure}

Dismiss the dialog by clicking ``OK'', and WAVE should open the record specified by the .xws file.

If you use Mozilla, choose Preferences from the Edit menu, then open the Navigator category and choose Helper Applications. Click on New Type... to pop up a dialog, where you should enter 'WAVEScript' as the Description of type, 'xws' as the File extension, 'application/x-wavescript' as the MIME type, and 'wavescript' as the Application to use' (omitting the quotation marks in each case). Click OK to close the New Type dialog, and click OK in the Preferences dialog to save your changes.

Figure 3.8: Adding wavescript as a Mozilla helper.
\begin{figure}\centerline{\epsfig{file=mozilla-new-helper}}\end{figure}

If your browser is Netscape 4.x, do this by choosing Preferences from the Edit menu, opening the Navigator category in the Preferences window, selecting Applications, then clicking on the New... button. Fill in the dialog box as shown in figure 3.9 (enter 'WAVEScript' as the Description, 'application/x-wavescript' as the MIMEType, 'xws' as the Suffixes, click on the radio button next to Application and enter 'wavescript %s' (note the '%s') as the Application, then save your settings by clicking on OK in each of the dialogs. (Other versions of Netscape have similar dialog boxes.)

Figure 3.9: Adding wavescript as a Netscape helper.
\begin{figure}\centerline{\epsfig{file=netscape-new-helper}}\end{figure}

If you use Galeon, choose Preferences from the Settings menu, then select Handlers, then MIME Types, then click on New. Enter 'application/x-wavescript' as the MIME type and 'wavescript' as the Helper (note that the quotation marks are not part of either entry). Select Run with helper and Always use this helper; do not select Run in terminal or Processes URL. Save your changes by clicking on Close. Note that Galeon does not support using the file suffix to select a helper application, so Galeon will only be able to control WAVE if the web server is properly configured to transmit the application/x-wavescript MIME type for .xws files (see Serving .xws files).

Figure 3.10: Adding wavescript as a Galeon helper.
\begin{figure}\centerline{\epsfig{file=galeon-new-helper}}\end{figure}

Similar operations may be possible with other browsers; consult your browser's documentation.

Once wavescript has been installed as a helper application, your web browser will launch wavescript whenever you click on a link to a .xws script file. As an example, here is a link to the example.xws script shown in the previous section: click here to view waveforms To provide such a link in an HTML document, use a statement such as

   <a href="example.xws">
   <img src="wave.png" alt="click here to view waveforms"></a>
George B. Moody (george@mit.edu)
2014-03-13