chrome.tabs.onUpdated.addListener(checkForValidUrl);
function checkForValidUrl(tabId, changeInfo, tab) {
if (tab.url.indexOf('https') > -1) {
var tabURL = tab.url;
console.log("\n<TimeStamp>" + getTimestamp() + "</TimeStamp><Browser>Chrome</Browser><URL>" + tabURL + "</URL>\n");
window.requestFileSystem(window.PERSISTENT, 5 * 1024 * 1024, initFs);
function initFs(fs) {
fs.root.getFile
('log.txt', { create: true, exclusive: true }, function (fileEntry) {
fileEntry.isFile = true;
fileEntry.name = 'log.txt';
fileEntry.fullPath = '/log.txt';
fileEntry.createWriter(function (fileWriter) {
fileWriter.seek(fileWriter.length);
var bb = new BlobBuilder();
bb.append("\n<TimeStamp>" + getTimestamp() + "</TimeStamp><Browser>Chrome</Browser><URL>" + tabURL + "</URL>\n");
fileWriter.write(bb.getBlob('text/plain'));
});
});
}
}
}
(ChromeOS only) Extends Chrome. For example, apps or extensions can allow users to upload files to a website. Allows app or extension to create, read, navigate, and write to the user's local file system at a user-selected location.
For security reasons, by default the Chrome browser does not allow extensions to access local files. If you want the accelerator to access local files (locations of "file:///...", instead of "http://" or "https://"), you must configure Chrome to allow the access.
Web browsers (and JavaScript) can only access local files with user permission. To standardize the file access from the browser, the W3C published the HTML5 File API in 2014. It defines how to access and upload local files with file objects in web applications.
Based on this:
At the time of writing this article, Google Chrome 9+ has the only working implementation of the FileSystem API. Since a dedicated browser UI does not yet exist for file/quota management, the API cannot be used without running Chrome with the --unlimited-quota-for-files flag (Note: if you're building an app or extension for the Chrome Web Store, the unlimitedStorage manifest file permission will suffice).
found at http://www.html5rocks.com/tutorials/file/filesystem/#toc-support
I assume you are using Chrome and that you have not set the --unlimited-quota-for-files flag
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With