我正在使用Electron尝试打开URL。我知道我可以做类似的事情
const { shell } = require('electron')
shell.openExternal('https://github.com')
在默认浏览器中打开URL。
是否可以在非默认浏览器中执行此操作?例如,如果我想打开到边缘存储的链接,但是我的默认浏览器是Chrome,我可以做些什么吗?
const { shell } = require('electron')
shell.openExternal('microsoft-edge:https://github.com')
您将无法仅使用default来做到这一点shell
,因为据我所知,它完全依赖于用户系统的默认值,但是现有的npm包(例如open)将为您提供此功能,其中包括:
await open('microsoft-edge:https://github.com');
他们的文档将指导您完成这项工作。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句