Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Without any more insight into your specific requirements, I would not recommend a pure Javascript/HTML solution. From a user perspective you would probably get the best results writing a native application. However if it will be faster to use Javascript/HTML, I recommend using a local application hosting a lightweight web server to serve up your content. That way you can cleanly handle the file saving server-side while focusing the bulk of your effort on the front-end application. </p> <p>You can code up a web server in - for example - Python or Ruby using very few lines of code and without 3rd party libraries. For example, see:</p> <ul> <li><a href="http://fragments.turtlemeat.com/pythonwebserver.php" rel="nofollow noreferrer">Making a simple web server in python</a></li> <li><a href="http://microjet.ath.cx/webrickguide/html/Writing_Custom_Servlet.html" rel="nofollow noreferrer">WEBrick - Writing a custom servlet</a></li> <li><a href="http://www.blendedtechnologies.com/python-trick-really-little-http-server/220" rel="nofollow noreferrer">python-trick-really-little-http-server</a> - This one is really simple, and will easily let you server up all of your HTML/CSS/JS files:</li> </ul> <pre> <code> """ Serves files out of its current directory. Doesn't handle POST requests. """ import SocketServer import SimpleHTTPServer PORT = 8080 def move(): """ sample function to be called via a URL""" return 'hi' class CustomHandler(SimpleHTTPServer.SimpleHTTPRequestHandler): def do_GET(self): #Sample values in self for URL: http://localhost:8080/jsxmlrpc-0.3/ #self.path '/jsxmlrpc-0.3/' #self.raw_requestline 'GET /jsxmlrpc-0.3/ HTTP/1.1rn' #self.client_address ('127.0.0.1', 3727) if self.path=='/move': #This URL will trigger our sample function and send what it returns back to the browser self.send_response(200) self.send_header('Content-type','text/html') self.end_headers() self.wfile.write(move()) #call sample function here return else: #serve files, and directory listings by following self.path from #current working directory SimpleHTTPServer.SimpleHTTPRequestHandler.do_GET(self) httpd = SocketServer.ThreadingTCPServer(('localhost', PORT),CustomHandler) print "serving at port", PORT httpd.serve_forever() </code> </pre> <p>Finally - Depending on who will be using your application, you also have the option of compiling a Python program into a <a href="http://www.devshed.com/c/a/Python/How-Python-Runs-Programs/4/" rel="nofollow noreferrer">Frozen Binary</a> so the end user does not have to have Python installed on their machine.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload