How to access SDcard by clicking on html link via javascript ..?
EDIT:
Basically, I want the Html file embedded in javascript or Jquery to be able to access the SDCARD content directly by opening it in the browser (since it is an html file). Since it is available for VIA, I posted the code for it, But I want to delete SDCARD documents directly, not from Android app.
Added:
I have an HTML file stored in an Sdcard which consists of javascript including code to access the contents of the SDcard.
I have tested the same code from Activity and webView and its working, but I want to content to be displayed on directly clicking on HTML Link
and not across the activity.
Is there a way to write. Android permissions in HTML CODE
Or how can I access it directly using HTML, JavaSCRIPT or JQUERY etc.
The code looks like this:
<!DOCTYPE HTML>
<html>
<head>
<title>Cordova</title>
<script type="text/javascript" charset="utf-8" src="cordova-2.2.0.js"></script>
<script type="text/javascript" charset="utf-8">
var edt=document.getElementById("")
function getFileSystem() {
window.LocalFileSystem = window.requestFileSystem
|| window.webkitRequestFileSystem;
alert("====== hey its me===");
window.requestFileSystem(1, 0, onFileSystemSuccessUpload, fail);
}
function fail() {
console.log("Error getting system");
}
function onFileSystemSuccessUpload(fileSystem) {
// get directory entry through root and access all the folders
var directoryReader = fileSystem.root.createReader();
// Get a list of all the entries in the directory
directoryReader.readEntries(successReader, fail);
}
function successReader(entries) {
var i;
for (i = 0; i < entries.length; i++) {
//alert(entries[i].name);
document.write("<p>" + entries[i].name+"</p>");
//document.getElementById("text1").innerHTML = "" + entries[i].name;
if (entries[i].isDirectory == true) {
var directoryReaderIn = entries[i].createReader();
directoryReaderIn.readEntries(successReader, fail);
}
}
}
</script>
</head>
<body>
<a onclick="getFileSystem()" href="javascript:void(0);">Click here to View File System</a>
</body>
</html>
cordova.js is stored in a parallel directory under the html file ../
source to share