How to open a local disk file with JavaScript?

前端 未结 9 2446
[愿得一人]
[愿得一人] 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:54

    You can't. New browsers like Firefox, Safari etc. block the 'file' protocol. It will only work on old browsers.

    You'll have to upload the files you want.

提交回复
热议问题