javascript - 无法在 Electron 中设置除了 `BrowserWindow` 的 `title` 之外的图标,就像 Chrome 中看到的 `favicon` 一样?

标签 javascript electron

我需要在 BrowserWindowtitle 旁边设置一个图标,就像在 Chrome 中看到的 favicon 一样。

即使我把它放在 HTML 中也不起作用。

<link rel="icon" type="image/x-icon" href="favicon.ico" />

我也尝试执行以下操作:

mainWindow = new BrowserWindow({
 width: 1200,
 height: 800,
 icon: path.resolve(__dirname, ‘favicon.ico’)
})

但是这不起作用。这真的可能吗?

Note: I am not talking about the app icon. I want an icon beside the title which is beside the traffic lights. For example, if you open VSCode for the 1st time you see Welcome at the top as shown in the image below. I want an icon besides Welcome

vscode welcome

最佳答案

你可以使用

new BrowserWindow({"frame":false})

并用CSS代码制作栏

关于javascript - 无法在 Electron 中设置除了 `BrowserWindow` 的 `title` 之外的图标,就像 Chrome 中看到的 `favicon` 一样?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60927786/

相关文章:

javascript - 使用带有部分地址的 if 语句来寻址链接

javascript - 将日期输入三 Angular 形更改为日历图标

javascript - 如何使用本地工具从本地文件系统读取 WebAssembly 文件 JavaScript

Python:运行使用 PyInstaller 制作的可执行文件时没有名为 'bottle-websocket' 的模块,包括 Eel 模块

electron - 安装与python脚本通信后无法拖动文件

javascript - 我如何将 mongodb 与 Electron 一起使用?

javascript - 设置 json 调用的间隔以重新加载新图像

javascript - 在 JavaScript 中从扁平化字符串构造数组

node.js - 删除 Node 通知程序中的终端图标

javascript - 用于 html/javascript 项目的可移植数据库