Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to write a local web application that does not need a server?

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?

like image 904
paperjam Avatar asked Dec 04 '11 22:12

paperjam


People also ask

Can we run a web application without a server?

In theory, it's possible to create "serverless" web applications using WebRTC, though WebRTC normally uses a signalling server to connect clients. This might be useful for sharing data between two different browsers on the same machine without an Internet connection.

Does application need server?

You need Application Server as follow: It provides you useful services like automatic transaction,Authentication,Authorization,Lifecycle management. To remember large user data across pages using ejb's pertaining to a client. Load balance the user request and buisness logic.

Can you make a web app without backend?

Yes, you can make a website without any backend system, but the website will be static, you will not be able to store anything, no storing user information, posts, or any form of data. The website will just be comprised of HTML, CSS, and Javascript files.


1 Answers

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:

  1. You can't connect to a database. This makes it difficult to do common stuff like storing states and user data.
  2. You can't set Content-type. This means you can't do any fancy XML stuff like serving SVG files or use XML in XMLHttpRequest.
  3. You can't generate dynamic images (with ImageMagick or GD). Although with HTML5 you can do it with the canvas.
  4. You can't read or write to the file system. Again this limits your ability to save data. But it can be done with correct user permissions (more on this below).

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.

like image 152
slebetman Avatar answered Nov 16 '22 01:11

slebetman