FindinSite-CD: Search engine for CD/DVD   .
 
Powered by FindinSite-MS
. Home | Examples | Starting | Set up | Advanced | Languages | Purchasing | Email .
. .
  Same window | New window | Vertical frameset | Within frameset | Subsets | JavaScript control | No applet window | Field search

 

findinsite-cd with no applet window


Introduction

This page shows how to make the FindinSite-CD search engine window invisible and show the results in HTML format instead:

This technique may make your CD more accessible to people with disabilities, as per the USA Section 508 regulations. Note that the user still must use a Java-enabled browser.

  • If running this example online, you will need to wait for FindinSite-CD to finish loading before it will work.
  • Netscape and Mozilla may take some time to show the first result. However, subsequent results will be quicker.

   Search Help

  1. Enter your search text.
  2. Click on the Search button.
  3. A list of pages containing all the words in your search text is displayed.
  4. To view a page, click on its title.
The FindinSite-CD Java applet runtime is an invisible window in here... Sorry, your browser is not set up to run Java applets.
How to get a Java VM.

If using Internet Explorer, you may need to allow blocked active content using the Information Bar - see here.
Or better still... go to Tools+Internet Options+Advanced tab then tick "Allow active content from CDs" and/or "Allow active content to run in files".

Results

How to set up FindinSite-CD to produce HTML results

The source of this page shows how to set up FindinSite-CD to produce HTML results.

First, FindinSite-CD must be run somewhere on the page with the applet named fisCD. However set the width and height parameters to 0 to make the FindinSite-CD window invisible, eg:

<APPLET CODE=fisCD NAME=fisCD WIDTH=0 HEIGHT=0 ARCHIVE="fiscd.jar" MAYSCRIPT>
<PARAM NAME=index1 VALUE="fisCDDb,en">
<PARAM NAME=rules VALUE="rulesen.txt">
<PARAM NAME=getFocus VALUE="false">
<PARAM NAME=LoadAllDbs VALUE="yes">
<PARAM NAME=sagrSearchTimeout VALUE="15">
Sorry, your browser is not set up to run Java applets.
</APPLET>

Next, set up a form for the user to enter their search, eg:

<FORM NAME="example" onsubmit="return DoSearch()">
<INPUT TYPE=text NAME=SearchText MAXLENGTH=30>
<INPUT TYPE=SUBMIT VALUE="Search">
</FORM>

Next, define an HTML division and layer to receive the results, eg:

<LAYER ID="res">
<DIV ID="results">Results</DIV>
</LAYER>

Finally, put this JavaScript code in the page head section:

<SCRIPT LANGUAGE=JavaScript>
<!--
function DoSearch()
{
    var Search = document.example.SearchText.value;
    var rv = document.fisCD.SearchAndGetResults(Search);

    if( document.layers)                // N4
    {
        var d = document.layers["res"];
        d.document.write(rv); 
        d.document.close(); 
    }
    else if( document.getElementById)   // N6+, IE5+, M1
        document.getElementById("results").innerHTML = rv;
    else if( document.all)              // IE4
        document.all["results"].innerHTML = rv;
    else
        alert('Sorry, this browser cannot display the search results');

    return false;
}
<!-- -->
</SCRIPT>

Program flow

The code in this page works as follows:
  1. The user enters search text in the form called "example".
  2. When they click on "Search", the JavaScript function DoSearch() is called.
    DoSearch() always returns false to stop any further processing of the form.
  3. DoSearch() gets the user's entered text and calls the FindinSite-CD function SearchAndGetResults().
    This returns the search results in as a string containing HTML.
  4. DoSearch() then updates the page.
    • In Navigator 4, this is done by writing to the layer called "res" - see below
    • In all other browsers, this is done by setting the innerHTML of the HTML division called "results", for most recent browsers using document.getElementById but using document.all in IE4.
    • If updating the HTML is not possible, then an error message box is shown.

Specifying which hits you want, and the timeout

Use the SearchAndGetResults2() function to say which hits you want to receive in the "From" and "To" parameters (1-based; specify 0 to receive all hits).

If the "ShowHeader" parameter is true, then the HTML output starts with text "xxx pages found<P>".

The "StartTimeout" parameter is used can be used if you are calling the function during page load: this specifies the time to wait for the applet to load in seconds (specify 0 to get the default of 20 seconds).

Results layout

You can alter the standard FindinSite-CD resultslayout parameter to include any HTML to be shown for each results line, but don't forget to include the special FindinSite-CD results tags that you want: <NUMBER> <TITLE> <TITLE_LINK> <FILENAME> <FILENAME_LINK> <URL> <URL_LINK> <ABSTRACT> and <WORDCOUNT>.

Unlike the FindinSite-CD results, the HTML results may take up several lines (as dictated by your HTML and the result information, eg the abstract).

Other returned messages

If the search database has not finished loading, a message "Search database loading... please try again soon" is returned.

Similarly, if the search times out (see below) then any available results are returned, followed by "Search timed out".

Both the above strings can configured in a language file or using an applet parameter - see the Languages page for details of the strings L_SEARCH_WAIT and L_SEARCH_TIMEDOUT.

Problems with this approach

There are a few drawbacks with this technique...
  • Suppose a user clicks on a hit and the page is shown in this page. If the user then clicks on Back then the results list will have gone.
  • The LoadAllDbs parameter must be set to yes to load all search database files at startup. Loading all search database files means that FindinSite-CD will take longer to start up, and FindinSite-CD will use more memory.
  • In Windows N4, the "res" layer must not be in a table; otherwise the results will overwrite the page, as in this example.
  • In Windows N4, you cannot scroll down to see all the results.
  • Windows N6+ and Mozilla can be slow on the first search (when Java-JavaScript starts).
  • The FindinSite-CD function SearchAndGetResults() has a built-in timeout of 15 seconds; if a search takes more than 15 seconds, then the user will see any available results followed by "Search timed out". You can change the timeout by setting the sagrSearchTimeout parameter.

  • Various browsers do not support this feature (primarily because they do not support communication between Java and JavaScript):

    • Windows: N3 and IE3 do not support this feature.
    • Mac OS 9: IE5 does not support this feature.
    • Mac OS 9: it does not work currently in N6 and N7 but a work around will be available oon.
    • Mac OS X: Safari 1.0 (v85) does not support this feature.
    • Mac OS X: it does not work in N7.

  • Tested OK in Windows IE4, IE5.5, IE6, N7, N6, N4.73, M1.5, O7.
In conclusion, the safest way to use FindinSite-CD is to use the standard FindinSite-CD window; if you can be reasonably sure of the browsers or platforms that your users use, then please consider the HTML Results feature.
  All site Copyright © 1996-2013 PHD Computer Consultants Ltd, PHDCC   Privacy  

Last modified: 1 February 2013.