In-Reply-To: <[EMAIL PROTECTED]>
(___cliff rayman___) asked: 
> 
> I would like to redirect our users directly to the resulting
> web page if only one web page is returned via a search.
> I have googled extensivly, and I cannot find a place where
> the question was even asked.    Has anyone tried this and
> found a method to make this work?

The clean way would be ECMAscript (JavaScript) in header.html
and a mod to long.html and short.html to enable the script to 
pick up $&(URL) (or plain $(URL) or something - go figure). 

A bit like this  - with apologies to Google and modulo thinkos:

const foo=1; /* 0-based sequence of the first hit in your output page;
                is 1 if you have one "refine search" FORM earlier in the
                output HTML than any result listing. */;

function feelingLucky() {
        if ("$(MATCHES)" == "1") {
                window.location.href=document.forms[foo].url1.value;
                /* do something with window.history if you feel like it */
        }
        else {
                /* nada */
        }
}


with long|short.html containing something like: 
  <FORM action="">
  <INPUT type="hidden" name="url1" value="$&(URL)">
  </FORM>
  <!-- rest of entry -->

This needs more thought needed about namespaces and/or anonymous 
forms and browser differences regarding these. 

There may well be a better mechanism for passing $(URL) to the 
script. Picking up document.links[foo].href is simple and robust
to browser differences - but requires anyone in future who 
changes the number of links in header.html to remember to 
update foo.

The unclean way is a branch of Ht://search that I'm not
going to think about :-)

Mike



-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
htdig-general mailing list <[EMAIL PROTECTED]>
To unsubscribe, send a message to <[EMAIL PROTECTED]> with a subject of unsubscribe
FAQ: http://htdig.sourceforge.net/FAQ.html

Reply via email to