Reading a txt file from Javascript

前端 未结 3 1983
猫巷女王i
猫巷女王i 2020-12-07 05:52

am trying to read few lines from a txt file using JS,and i have this code but its not working for some reason,,

var fso = new ActiveXObject(\"Scripting.FileS         


        
3条回答
  •  醉酒成梦
    2020-12-07 06:04

    Only IE supports ActiveXObject. Trying to use ActiveXObject on any other browser will fail because there is no such variable defined.

    You need to either limit yourself to IE, write a browser plugin instead, or give up trying to get file system access on other browsers and proxy files through a server instead.

提交回复
热议问题