简体   繁体   中英

“Not allowed to load local resource” Electron/VUE

So I am receiving the error "Not allowed to load local resource" in my Electron/VUE app. The error I believe is coming from my index.ejs file where I have

<style>
 .background{
  background: url('file:///images-benjamin-child-17946.jpg') no repeat center center fixed;
 background-size cover;
}
</style>

the image benjamin-child is located in the images folder which should have a path something like: electronApp/app/images

Installing/running the app is easy you can just follow the README.md.

I took a look at that repo, and in this case, if you just copy the image file into the dist directory and use

background: url('/benjamin-child-17946.jpg') no-repeat center center fixed;

it should work. Presumably there is a webpack setup that will copy files from the static directory in the app to dist for you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM