1

I have been working on a HTML/JavaScript program which requires to be downloaded on to you local computer. I am wanting the program to load .mp3 files form the users music folder and display it. How can I do this locally without PHP.

1 Answer 1

1

For security reasons,

All the popular browsers does not let you load files from the local computer by default, unless the user select the file (or drag and drop it) on the browser (html5 example here).

Also, the browsers do not let you see a folder's content so that you know the files inside it.

In order to have full access to the file system with javascript, you need something else.

Web App as a computer app

For now, the best way to build a computer application using Web technologies (HTML, Javascript, CSS), is either NW.js or Electron


NW.js

From their github

NW.js is an app runtime based on Chromium and node.js. You can write native apps in HTML and JavaScript with NW.js. It also lets you call Node.js modules directly from the DOM and enables a new way of writing native applications with all Web technologies.

You can start by building your code as a NW.js app (Getting started doc on their github)


Electron

Form their page

If you can build a website, you can build a desktop app. Electron is a framework for creating native applications with web technologies like JavaScript, HTML, and CSS. It takes care of the hard parts so you can focus on the core of your application.


Node.js

You can use Node.js 's API for file system access (fs doc)

1

Not the answer you're looking for? Browse other questions tagged or ask your own question.