简体   繁体   English

自动运行Firefox扩展

[英]Autorun firefox extension

I am creating firefox extensions and I want to autostart extensions with browser. 我正在创建Firefox扩展,我想使用浏览器自动启动扩展。 Without any click, it's just start in background. 无需任何点击,它只是在后台启动。 I know this is possible, for example ghoster plugin can do it, but its code is huge, so it take me too much time to analyze it. 我知道这是可能的,例如ghoster插件可以做到,但是它的代码很大,因此花了我太多的时间来分析它。 And by the way, I don't want wait to any page load, or anything. 顺便说一句,我不想​​等待任何页面加载或任何东西。 Immediately after firefox start. Firefox启动后立即。 Any hints ? 有什么提示吗?

The code of the extension is able to run as soon as the browser loads. 该扩展程序的代码能够在浏览器加载后立即运行。 You probably just have to add an eventlistener to let the extension know that the browser is ready: 您可能只需要添加一个事件侦听器,以使扩展程序知道浏览器已准备就绪:

window.addEventListener("load",function() {yourBrowserLoadFunction();}, false);

The code inside the function yourBrowserLoadFunction() will run as soon as the browser starts. 浏览器启动后,函数yourBrowserLoadFunction()的代码将立即运行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM