EDIT:
Basically i want an Html file embeded with javascript or Jquery that can access SDCARD contents directly,while opening it in a browser(since it is an html file).Since it is accessible VIA an activity i have posted code for it,But i want to hit SDCARD docs directly rather than from an android app.
Posted:
I have a HTML file stored in Sdcard which consist of a code including javascript to access SDcard contents.
I have tested the same code from an Activity and webView and its working fine,But i want that the content to be displayed on directly clicking on HTML Link
rather than through an activity.
Is there any way to write Android permissions in HTML CODE
.or how would i access it directly using HTML,JavaSCRIPT or JQUERY etc..
The code is as follows:
<!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 kept in parallel directory as of html file../