尝试通过npm start
启动我的电子应用后遇到以下错误。这是错误消息:
TypeError: Cannot read property 'setZoomLevelLimits' of undefined
以下是代码:
const electron = require("electron").webFrame.setZoomLevelLimits(1, 1);
const app = electron.app;
const BrowserWindow = electron.BrowserWindow;
let mainWindow;
app.on("ready", function(){
mainWindow = new BrowserWindow({
width: 800,
height: 600,
frame: false,
kiosk: true
});
mainWindow.loadURL("file://" + __dirname + "/index.html");
// Debug3
// mainWindow.openDevTools({ detach: true });
});
我试图阻止用户在我的桌面应用中的屏幕上拖动和缩放,website-user-drag: none
不能正常工作:
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width, height=device-height, target-densitydpi=device-dpi" />