Angular 2 app - link to local file

前端 未结 1 1029
难免孤独
难免孤独 2021-01-25 01:42

In my app I\'m viewing a list of files on the local machine (their paths are fetched from DB). When a file is being clicked, it should be opened. I tried the following with no s

1条回答
  •  失恋的感觉
    2021-01-25 02:23

    You cannot access local resources from a website served over http because it is a security concern. Think of what would happen to your machine if any website could access files on it. You'll have other security restrictions for serving data from a different domain from your domain as well.

    What exactly are you trying to accomplish by accessing a local file? Giving additional insight into the reason might get you more useful suggestions. Otherwise, the answer is that you can't and shouldn't do this.

    0 讨论(0)
提交回复
热议问题