I want to create a local application that has a browser-based UI rather than a stand-alone GUI based on MFC / Qt / etc. If I don’t want to run a webserver on the local machine, how can I implement the dynamic parts of my app? Can the browser be pointed to local scripts, executables or libraries on the machine? Can I use a local database directly> What pitfalls are there with this approach?
Share
Yes it is, but with limitations. The main limitation is that you can’t do any CGI stuff because the browser will open and display your script source code instead of executing them. This has several implications:
But there are workarounds. HTML5 allows you to store data in local storage but obviously this won’t work in older browsers. You can store data in cookies instead but that has size limitations. Finally you can actually save to file. You have to instruct your users to modify their browser preferences to allow your script to do this but it can be done. One example of this is TiddlyWiki. It is a self-contained personal wiki in a single HTML file. Every time you save new content the page modifies and saves itself. You may want to look at how they do it for inspiration.