hi .
i want to load html file to new window in electron-vue , but don`t work this code :
var APP_DIR = path.resolve(__dirname, 'src')
const BrowserWindow = electron.remote.BrowserWindow
const childWindow = new BrowserWindow({
width: 800,
height: 600,
})
childWindow.loadURL(file:/${APP_DIR}/print.html)
childWindow.show()
Even with change APP_DIR to :
create print.html file to component/src
childWindow.loadURL(file://${__dirname}/print.html) // not work
create print.html file to static dir
childWindow.loadURL(path.join(__static, /print.html)) // not work
data:text/html,chro…:1 Not allowed to load local resource: file://volumes/File%20Drive/electron-apps/restaurant-application/src/renderer/components/src/print.html
Electron : 1.7.12
node : v9.5.0
NPM : 5.6.0
Try this. Go to src/main/index.js and set webSecurity to false for development mode:
mainWindow = new BrowserWindow({
...
webPreferences: {
webSecurity: process.env.NODE_ENV !== 'development'
}
})
Most helpful comment
Try this. Go to
src/main/index.jsand setwebSecurityto false for development mode: