findinsite-cd with no applet window
This page shows how to make the FindinSite-CD search engine window invisible and show the results in HTML
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.
- Enter your search text.
- Click on the Search button.
- A list of pages containing all the words in your search text is displayed.
- To view a page, click on its title.
The FindinSite-CD Java applet runtime is an invisible window in here...
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
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.
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">
Next, define an HTML division and layer to receive the results, eg:
var Search = document.example.SearchText.value;
var rv = document.fisCD.SearchAndGetResults(Search);
if( document.layers) // N4
var d = document.layers["res"];
else if( document.getElementById) // N6+, IE5+, M1
document.getElementById("results").innerHTML = rv;
else if( document.all) // IE4
document.all["results"].innerHTML = rv;
alert('Sorry, this browser cannot display the search results');
The code in this page works as follows:
- The user enters search text in the form called "example".
DoSearch() is called.
DoSearch() always returns
false to stop any further processing of the form.
DoSearch() gets the user's entered text and calls the FindinSite-CD function
This returns the search results in as a string containing HTML.
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).
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:
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...
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.
- 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
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.
- 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
- Various browsers do not support this feature (primarily because they do not support
- 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.