English 中文(简体)
我怎样才能在我的电灯上添加一种习俗。
原标题:How can I add a custom chrome extension to my Electron app?

I am facing some trouble adding chrome addons into my Electron BrowserWindow.

在创建我的窗口(并在<代码>>>>>>>>><>>>>活动之后)之前,我试图增加我的浏览器需要做的“玻璃”延伸。

BrowserWindow.addDevToolsExtension( /home/USER/.config/chromium/Default/Extensions/dkjdkjlcilokfaigbckcipicchgoazeg/1.5_0 );

I followed this Electron guide, and it worked for their example (adding the react develop tool). When I do the exact same thing with my own chrome extension I have this error:

[4735:1116/163422.268391:ERROR:CONSOLE(7701)] "Skipping extension with invalid URL: chrome-extension://extension-name", source: chrome-devtools://devtools/bundled/shell.js (7701)

我没有真正了解具体错误为何是“无效的URL”,因为我做的是完全相同的事/过程,没有问题就用反应堆添加。 我也不知道要做什么。 我的神父是否可以连系成电吗?

最佳回答

Support for Chromium extensions in Electron is actively being worked on at the moment. The support isn t complete yet, but the GitHub issue seems to have regular updates being posted.

Fingers crossed!

一项目前的拉皮书开放供查阅:https://github.com/electron/electron/pull/19515"rel=“noreferer”>。 仅够延长[api]装上简单的......延期

问题回答

It looks like you re trying to add a regular Chrome extension instead of a Dev Tools extension.

<代码>BrowserWindow.addExtension(path)方法是常规的 Chrome延:

BrowserWindow.addExtension(path)

  • path String

Adds Chrome extension located at path, and returns extension s name.

如果延期清单缺失或不完整,该方法也不会返回。

<>说明: 不能在<代码>ready前打电话。 www.un.org/Depts/DGACM/index_french.htm 模块已投入使用。

- https://electronjs.org/docs/api/browser-window#browserwindowaddextensionpath

Conversely, the BrowserWindow.addDevTools Extension(path) method is for Dev Tools extensions:

BrowserWindow.addDevTools Extension(path)

  • path String

AddsDevTools extension, 地址:path, 并注明返回国名。

The extension will be remembered so you only need to call this API once, this API is not for programming use. If you try to add an extension that has already been loaded, this method will not return and instead log a warning to the console.

如果延期清单缺失或不完整,该方法也不会返回。

<>说明: 不能在<代码>ready前打电话。 www.un.org/Depts/DGACM/index_french.htm 模块已投入使用。

<https://electronjs.org/docs/api/browser-window#browserwindowadddevtoolsextensionpath”rel=“noreferer”>https://electronjs.org/docs/api/browser-window#browserwindowadddevtooltensionpath

请注意,在这两种情况下,你都需要等待<代码>ready。 www.un.org/Depts/DGACM/index_french.htm 模块:

const { BrowserWindow, app } = require( electron )

let mainWindow = null

function main() {
  BrowserWindow.addExtension( /path/to/extension )
  mainWindow = new BrowserWindow()
  mainWindow.loadURL( https://google.com )
  mainWindow.on( close , event => {
    mainWindow = null
  })
}

app.on( ready , main)

While there is a documented method to register a normal extension, in majority of cases it won t do much, as Electron supports only an accessibility subset of the chrome.* APIs (apparently only the stuff required by Spectron and Devtron) and as they ve stated a while ago, they don t have any plans to support Chrome extension APIs at a full scale.





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签