Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/362.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript ElectronJS ReferenceError:未定义导航器_Javascript_Electron_Custom Titlebar - Fatal编程技术网

Javascript ElectronJS ReferenceError:未定义导航器

Javascript ElectronJS ReferenceError:未定义导航器,javascript,electron,custom-titlebar,Javascript,Electron,Custom Titlebar,我在试着做一个关于电子的自定义标题栏。但当我启动我的应用程序时,我遇到了“ReferenceError:navigator未定义”的问题。请帮忙。这是mymain.js中的代码片段 这不能在中执行。 主要的过程是管理。在电子主流程中不会有任何导航器。是浏览器的属性 渲染器负责将代码渲染到browserWindow。因此,您可以访问浏览器窗口的导航器(位于渲染器非主位置) 因此,请将其移动到您想要自定义标题栏的渲染器 这将非常有效。lmk,在main.js m8中导入此自定义电子标题栏。请在渲染

我在试着做一个关于电子的自定义标题栏。但当我启动我的应用程序时,我遇到了“ReferenceError:navigator未定义”的问题。请帮忙。这是mymain.js中的代码片段

这不能在中执行。 主要的过程是管理。在电子主流程中不会有任何导航器。是浏览器的属性

渲染器负责将代码渲染到browserWindow。因此,您可以访问浏览器窗口的导航器(位于渲染器非主位置)

因此,请将其移动到您想要自定义标题栏的渲染器


这将非常有效。

lmk,在main.js m8中导入此
自定义电子标题栏
。请在渲染器中使用此标题栏。您的主进程仅用于管理渲染器进程。主屏幕上没有导航器
// 1. Require the installed module
const customTitlebar = require('custom-electron-titlebar');
// 2. Create the custom titlebar with your own settings
//    To make it work, we just need to provide the backgroundColor property
//    Other properties are optional.
let MyTitleBar = new customTitlebar.Titlebar({ backgroundColor: customTitlebar.Color.fromHex('#03a9f4')});