Cannot open local file - Chrome: Not allowed to load local resource

后端 未结 14 1634
不知归路
不知归路 2020-11-22 12:01

Test browser: Version of Chrome: 52.0.2743.116

It is a simple javascript that is to open an image file from local like \'C:\\002.jpg\'

function run(         


        
14条回答
  •  不知归路
    2020-11-22 12:45

    If you could do this, it will represent a big security problem, as you can access your filesystem, and potentially act on the data available there... Luckily it's not possible to do what you're trying to do.

    If you need local resources to be accessed, you can try to start a web server on your machine, and in this case your method will work. Other workarounds are possible, such as acting on Chrome settings, but I always prefer the clean way, installing a local web server, maybe on a different port (no, it's not so difficult!).

    See also:

    • Open local files(file://) using Chrome
    • Opening local files from chrome

提交回复
热议问题