Reputation: 13254
Sometimes I need to write a small program just to represent some data in a chart, or similar stuff. I have been wanting to do this kind of things through the browser, with HTML5. I think it would be nice to use its canvas to create a nice UI for simple apps.
I have read some articles related to offline applications with HTML5, but they focus on downloading all the data you need and save it to the cache to use it offline later. You even need to set up an Apache server (or similar) to create your app.
I don't need my app to be online, just in my computer. I just want to create a simple application, nothing to do with internet at all.
How can I do this? Is it even possible or worthy? Is there any "Hello world!" tutorial about this around there?
Upvotes: 1
Views: 563
Reputation: 1234
If you ever find you need to read static HTML+Javascript files locally then I'd recommend using this python command in the console:
python -m SimpleHTTPServer
It launches a simple HTTP server (who'd of guessed) that serves files from the current working directory. Effectively, it's the same as launching an apache webserver, putting some static assets in /var/www/...
etc. etc.
You could also just browse to the assets at file:///some/folder
; however, most browsers will prevent javascript from using AJAX when files are loaded in that way, which will manifest as a bunch of bugs when you go to load it.
Upvotes: 0
Reputation: 38183
Something like Mozilla Prism would be good for displaying the content as an application.
There's no need to have a web server like Apache for just displaying HTML5/Javascript in a browser. You can just have it all in a folder on your desktop and then load it in the browser with the file://
protocol.
For example file://C:/Documents and Settings/YourUser/Desktop/YourApp/index.html
would open an HTML file in a folder called YourApp
on your user's desktop.
Upvotes: 2