【发布时间】:2017-06-21 12:18:43
【问题描述】:
每次窗口开始加载新的 html 或向服务器发出请求时,窗口都会变白,直到页面完成加载或服务器响应请求。这看起来一点也不好看,而且可能很刺耳。 我怎样才能阻止这种情况?
如果您想查看代码
app.js
const {app, BrowserWindow} = require('electron');
const path = require('path');
const url = require('url');
let win;
function createWindow () {
// Create the browser window.
win = new BrowserWindow({width: 800, height: 600});
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}));
win.on('closed', () => {
win = null;
})
}
app.on('ready', createWindow);
app.on('window-all-closed', () => {
if (process.platform !== 'darwin') {
app.quit();
}
});
app.on('activate', () => {
if (win === null) {
createWindow()
}
});
inedx.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body style="background-color: #222222">
<a href="index.html" style="color: white">Click on me to see a flash</a>
</body>
</html>
【问题讨论】:
标签: javascript html css node.js electron