Categories:

Home / Free JavaScripts / JS Search Engines / Here

Cut & Paste JavaScript internal site search script (Netscape Version)

Credit: Satadip Dutta

Description: A cool client-side internal site search script. This script will actually allow your surfers to search the contents of your own web site. There are two versions of the script- one for NS, and one for IE. Each one will not work with the other. The current page demonstrates the Netscape version- if you are using IE, click here for the IE version instead. Thanks to Satadip Dutta for this great script and giving us the permission to feature it.

Detailed description: This script is client-side based, which has its advantages and disadvantages. The good part is, any site can use it to add internal search capabilities to it, whether your site is on Geocities, or any other server, for that matter. The search engine is simply a script, like any other script posted on JavaScript Kit. Now for the bad part. Since it is client-based, the entire search engine has to be downloaded onto the surfer's computer before he/she can begin the search. That's ok if the search engine is set to search only 20 pages. But what if you wanted it to search thousands of pages? The script will be too large to be of practical use. The most common method of internal search on the net is actually through CGI (Common Gateway Interface), in which the search engine resides on a server, and the server passes only the search results (not the entire database, like client-side) to the surfer. Imagine if Search Engine sites (ie:  Hotbot) used client-based engines to perform their searches...prepare to wait a century (literally) before you can even begin your query! To sum it up, if your server supports CGI (apart from Hypermart, none of the free web hosts I know of do), try to find a CGI script that does the same thing. It's a lot harder to set up though. For the rest of us, I highly recommend this script- its the best JavaScript search engine I've seen to date.

Example: (I've currently configured the engine to search many pages of my JavaScript tutorial, 14 pages in all). Try typing in JavaScript related keywords such as "object", "window", or "function", for example.

Keywords:

Directions: Click here first and choose "save as" to get the general search engine script page.

Using a simple text editor, open up the page, and read the first paragraph in the source code. It walks you through the entire process of configuring the page to search pages of your own site. Don't worry, it is VERY easy, even if you have absolutely no JavaScript background.

Ok, you're worried. But you shouldn't be. I'll briefly explain the process to reinforce the documentation you'll find inside the script, which is already very clear and easy to follow.

In the script, 1/4 down the page, you'll see the line title[0]=14, as shown below. 14 was used in my case, because I wanted it to search 14 pages. Change this number to reflect your own. Moving down, you will see many chunks of four lined codes. The first line title[1] should contain the keywords you want associated with a certain page. Choose these carefully, because your search engine is only as good as the keywords used to search it. desc[1] should contain the description shown if that page is matched and displayed. Lastly, links[1] should contain the URL of that page. This process repeats for all 14 pages. Yes, that's all there is to the configuration!

title[0]=14
"
"
"
"

title[1]="Introduction FAQs Java JavaScript beginner"
desc[1]="JavaScript Primer (Part 1 of 2) "
links[1]="http://www.javascriptkit.com/primer1.htm"
matched[1]=0

title[2]="objects document function parameter last modified date"
desc[2]="JavaScript Primer (Part 2 of 2) "
links[2]="http://www.javascriptkit.com/primer2.htm"
matched[2]=0
"
"



Premium Wordpress
Hosting
Bluehost.com $6.95 Hosting
$6.95 Hosting
Web Hosting with cPanel - only $1 / month from GoDaddy
Godaddy domains
and hosting
JavaScript Tools:
Site Info


CopyRight (c) 2018 JavaScript Kit. NO PART may be reproduced without author's permission. Contact Info