问题
Operating system : Windows 8.
Input-from : A text field from a html page . Input-type: text.
Output : the file that was searched.
What I want : I want the user to enter some keywords and have JavaScript search the user's local files...
Is there any way? or A javascript Library?....
And how I can query the file system about the files using Javascript..in Windows..
EDIT::
Thanks everyone for the reply... The way I get it is ,either I have to develop my own browser based in Java that has sufficient permissions.. or
I would have to implement a file crawler that indexes everything that sends that file to the a server , so that javascript can then access it through xmlhttp requests to the server ....
This was just a curiosity and I don't want to expose anyone's personal files on the Internet.
A fun project.. That all tinkered in my mind.
回答1:
This is not possible from a web page because of the browser's security restrictions. You could access the local file system with Node.js or an Electron app, but I don't know if that would suit your use case
回答2:
No. That's simply not possible and even if it is, it should not be used, as it would make one's local file system open to various threats because you are directly exposing your machine on the internet. That's sufficient enough reason for a webapp not to access one's local file system in any manner whatsoever.
P.S: If you really want it, There are a few third party libraries which use Sandboxed file systems. You can try that if you want.
I havent tried it personally, but found the below link via quick googling so i am not sure if its officially supported up until now.
https://www.html5rocks.com/en/tutorials/file/filesystem/
回答3:
Use <input type="file">
, which implements ability for user to select file from local filesystem.
来源:https://stackoverflow.com/questions/43309211/how-to-search-the-local-file-system-of-windows-using-javascript