How can JavaScript get data from a user's computer?

advertisements

How can Javascript (running from a website on a remote server) access data from a user's local computer? I have access to all the user's computers and they are all using Chrome. The data may be stored in a file, a database, I can even run a webserver on their computers if needed, etc. Is there any way for my users to for example allow my website to access data from JavaScript? (maybe be there is a Chrome setting but I still want their browser to be secure)


It sounds like you are flexible as to where the data is stored in the user's computer. In that case use localStorage or Web SQL Databases. Web SQL Databases are no longer part of the HTML5 spec, but they are supported by Chrome. Using either of these methods will store the data on the users computer - right in the browser in fact.

Edit: In the application that provides the caller id data, have it launch your website with chrome passing in a querystring argument containing the needed caller id data. Then in your page, have it listen to the onstorage event, and update the dropdown when the appropriate localStorage data has changed.

In your caller id app, call:

%ChromeInstallPath%\chrome.exe "http://foo.com/[email protected]"

In your caller handler, use this JavaScript:

window.onload = function() {
    localStorage.callerId = location.search;
};

In your page with the drop down list, use this JavaScript:

window.onstorage = function() {
    setDropDownFromCallerId(localStorage.callerId);
};