How to open a local disk file with JavaScript?

前端 未结 9 2012
[愿得一人]
[愿得一人] 2020-11-22 01:21

I tried to open file with

window.open(\"file:///D:/Hello.txt\");

The browser does not allow opening a local file this way, probably for sec

9条回答
  •  不思量自难忘°
    2020-11-22 01:46

    The HTML5 fileReader facility does allow you to process local files, but these MUST be selected by the user, you cannot go rooting about the users disk looking for files.

    I currently use this with development versions of Chrome (6.x). I don't know what other browsers support it.

提交回复
热议问题