I’m writing a pretty simple database application, which I want to be locally stored (as opposed to looking up a remote database). I like HTML/Javascript for designing interfaces, and they’re cross-platform (everybody has a browser!), so I’d really like to write a webpage as a frontend. No client/server interaction should be involved – I just want the users to be able to interact with the database using a browser, instead of a native program.
However, the only way I can see to access databases from a browser is using something like WebSQL or IndexedDB. Both of these, however, abstract away the process of managing the database file itself, and store it away in user settings somewhere. I want to distribute the database file itself along with the app.
In short: is there a way to use HTML/Javascript to modify a local SQLite database file? Or is HTML not the tool I should be using for this sort of application?
EDIT: possibly relevant
This is what I’ve ended up doing:
As referred to here, you can use Python to create a local web server. This tutorial gives a basic infrastructure for the server handler. I had to deal with some issues, possibly caused by Python 3 or by using Chrome to access my local page.
My GET handler function ended up looking like this:
Where
GETHANDLERSis a dictionary mapping URLs to functions – for example, if you visithttp://localhost/my_func, theGETHANDLERS['my_func']function is called. If no function exists for the URL, the URL is just echoed back.I’ve implemented functions that manipulate a local SQLite database with the
sqlite3module. Here’s an example of the query to list everything in theCategoriestable:To use the local app, it’s necessary for the user to install Python, then run the server script before opening the webpage. I think this is pretty acceptable!