Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating a Javascript local application(ran in browser)?

I'd like to write an application that would use both Javascript and HTML as for the user interface. The app wouldn't really need an internet connection but will need access to the user's local files.

My first thought was that this would be impossible in a browser due to the security restrictions on the access to local files.

My second thought was to try to use webkit directly from C++ and use Python instead of Javascript, but that seems rather complicated, and I feel like overkilling by using Qt.

My third thought was to use a signed Java applet to make all local accesses, but then I'm not too sure of this either.

Any suggestions on what I should do?

like image 523
Manux Avatar asked Jan 28 '11 21:01

Manux


People also ask

Which is used for running the application on browser?

Users can access a Web application through a web browser such as Google Chrome, Mozilla Firefox or Safari. For a web app to operate, it needs a Web server, application server, and a database. Web servers manage the requests that come from a client, while the application server completes the requested task.

Can you write an application in JavaScript?

One of the most interesting things developers can do today with JavaScript is building applications for non-web contexts. This means that you can use JavaScript to create applications that aren't published on the internet.

Can you create a website with only JavaScript?

No it is not possible. You can even make a website with HTML only but it doesn't make sense. You need CSS to adjust appearance of your website and JavaScript for animations and interactions.


2 Answers

I'll admit that I know very little about this, but it sounds like what you're after is what XUL provides.

From the homepage:

XUL (XML User Interface Language) is Mozilla's XML-based language that lets you build feature-rich cross platform applications that can run connected or disconnected from the Internet.

...

Web developers already familiar with Dynamic HTML (DHTML) will learn XUL quickly and can start building applications right away.

Regarding filesystem access: https://developer.mozilla.org/en/Code_snippets/File_I//O

This article describes local file input/output in chrome JavaScript.

You access the file system using Mozilla XPCOM components. A list of resources and interfaces for local I/O is available for both Files and Streams at XUL Planet.

Because of my lack of familiarity, I'll leave it up to the community to decide whether or not this answer has merit.

EDIT: Making this answer a community wiki since I don't have much real information to offer.

like image 171
user113716 Avatar answered Sep 28 '22 02:09

user113716


It seems, 5 years after the question was asked, there is a framework to do exactly this: build cross platform desktop app with JavaScript, HTML, and CSS, and with access to local files, http://electron.atom.io/.

I have not used it myself, but it is recommended in other answers.

like image 45
Alex Fainshtein Avatar answered Sep 28 '22 02:09

Alex Fainshtein