admin管理员组文章数量:1352341
I am trying to make an with React and Electron. When I use http, it's working perfectly.
app.on('ready', () => {
mainWindow = new BrowserWindow({
titleBarStyle: "hidden",
width: 1000,
height: 700,
});
mainWindow.webContents.openDevTools();
mainWindow.loadURL("http://localhost:3000");});
But I need to use the protocol https for my app, so I am writing to run the react script : HTTPS=true npm start
. It's running on Chrome with the link https://localhost:3000/. But when I change the mainWindow.loadURL to mainWindow.loadURL("https://localhost:3000")
It show a white screen without error in the console.
I am trying to make an with React and Electron. When I use http, it's working perfectly.
app.on('ready', () => {
mainWindow = new BrowserWindow({
titleBarStyle: "hidden",
width: 1000,
height: 700,
});
mainWindow.webContents.openDevTools();
mainWindow.loadURL("http://localhost:3000");});
But I need to use the protocol https for my app, so I am writing to run the react script : HTTPS=true npm start
. It's running on Chrome with the link https://localhost:3000/. But when I change the mainWindow.loadURL to mainWindow.loadURL("https://localhost:3000")
It show a white screen without error in the console.
1 Answer
Reset to default 9The issue is because of the certificate error.
Try adding the following lines inside your main.js file.
app.on('certificate-error', function(event, webContents, url, error,
certificate, callback) {
event.preventDefault();
callback(true);
});
If you want your application to run on https
, the ideal solution would be to use the proper certificate.
Hope you find this helpful.
版权声明:本文标题:javascript - mainWindow.loadURL("https:localhost:3000") show white screen on Electron app - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743904211a2559224.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论