简体   繁体   English

firefox作为插件安装运行代码

[英]firefox as addon installed run code

When a user adds our addon to their browser (firefox) as the browser restarts we would like it to run the function whats_new() 当用户在浏览器重新启动时将其插件添加到其浏览器(firefox)中时,我们希望它运行功能whats_new()

Where do we put the code for that? 我们将代码放在哪里?

Or in other words, is there some way I can run whats_new() as my plugin is loaded in Firefox? 换句话说,当我的插件加载到Firefox中时,有什么方法可以运行whats_new()吗?

Thanks! 谢谢!

Short answer: 简短答案:

https://developer.mozilla.org/en/XPCOM/Receiving_startup_notifications https://developer.mozilla.org/en/XPCOM/Receiving_startup_notifications

Longer Answer (with history): 更长的答案(包含历史记录):

https://developer.mozilla.org/en/Observer_Notifications https://developer.mozilla.org/zh-CN/Observer_Notifications

That URL describes the "app-startup" which I think is exactly what you want ... and it's no longer supported :-( 该URL描述了“ app-startup”,我认为这正是您想要的...并且不再受支持:-(

However, as this URL explains: 但是,正如该URL所解释的:

https://developer.mozilla.org/en/XPCOM/XPCOM_changes_in_Gecko_2.0#Category_registration https://developer.mozilla.org/zh/XPCOM/XPCOM_changes_in_Gecko_2.0#Category_registration

there is now an alternate way of doing something similar, using the "profile-after-change" category. 现在,存在一种使用“更改后配置文件”类别进行类似操作的替代方法。

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

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