Mobile app version of vmapp.org
Login or Join
Goswami781

: Create a search for my HTML and CSS site that runs without an internet connection or database? I have a website that I have written out in plain old HTML and CSS, and want to integrate a

@Goswami781

Posted in: #Html #MetaTags #Mysql #Php #Search

I have a website that I have written out in plain old HTML and CSS, and want to integrate a search function into it. However, the site is meant to be run offline, from host machines in their local web browsers (i.e. without an internet connection).

I realize that I could easily integrate a search using a mySQL database, though that would require everyone to have a mySQL database running on their computer with the proper data. I was wondering if it would be possible to integrate a search box that wouldn't need to connect to a database (or at least one that didn't require an AMP stack running on each user's local machine).

I have searched around and haven't been able to find a solution to a similar problem. The search doesn't have to be simple, just something that would be able to present the titles of HTML pages in a list (I don't need the content of each HTML document to be searched, just the titles of each page). I was thinking there might be some way to return the titles and descriptions of each page for the search either using each page's <meta> tags, or by having a plain text document at the site root with a listing of all of the pages. Any help would be greatly appreciated!

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Goswami781

3 Comments

Sorted by latest first Latest Oldest Best

 

@Kaufman445

This would work, as long as the machines could have access to a local copy of the necessary php file.
www.w3schools.com/php/php_ajax_livesearch.asp
It's pretty simple to implement, also it perfectly matches you criteria


"just something that would be able to present the titles of HTML pages
in a list (I don't need the content of each HTML document to be
searched, just the titles of each page)."

10% popularity Vote Up Vote Down


 

@Cofer257

There is no way to automatically search through all the HTML files. However, assuming your pages are generated in some way for the user to download, you could also generate a Javascript file with an array of pages/keywords.

For example it could generate some JSON object like var site_index = [ {page:"hello.html",keywords:"hello,world,etc"}, ... ];

Then a function to take an input from a form and find matching pages.

10% popularity Vote Up Vote Down


 

@Angie530

Create a sitemap/index XML file including the titles (and perhaps some keywords) for use in search
Apply an XSL template on the sitemap/index XML file which displays a search form
Create a Javascript which responds to search form input with an XQuery to filter/sort the sitemap/index XML file

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme