在我的Firefox插件警报窗口 [英] alert window in my firefox addon

查看:146
本文介绍了在我的Firefox插件警报窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对firefox插件的开发很新鲜,所以如果太笨的话请原谅。我试图从我的插件启动一个警告窗口:



pre> alert('This is an alert');

但是,它不会识别'alert'。什么组件应该包含(要求)?



谢谢!

解决方案

也许这可以帮助你?



https://developer.mozilla.org/en-US/docs/XUL/School_tutorial/User_Notifications_and_Alerts?redirectlocale=en-US&redirectslug=XUL_School%2FUser_Notifications_and_Alerts



由于链接偶尔会死掉,我会为您节省一些滚动操作,并发布可能最有用的代码:

  let alertsService = 
Cc [@ mozilla.org/alerts-service;1\"].getService(Ci.nsIAlertsService);
let title = this._bundle.getString(xulschoolhello.greeting.title);
let message = this._bundle.getString(xulschoolhello.greeting.label);

alertsService.showAlertNotification(
chrome://xulschoolhello/skin/hello-notification.png,
title,message,true,,this,XULSchool Hello信息);


I'm fresh to firefox addons development, so pls excuse me if it's too dumb. I just couldnt find the answer here in the Stack.

I try to launch an alert window from my addon:

alert('This is an alert');

However, it won't recognize 'alert'. What component should I include (Require)?

Thanks!

解决方案

Perhaps this could help you?

https://developer.mozilla.org/en-US/docs/XUL/School_tutorial/User_Notifications_and_Alerts?redirectlocale=en-US&redirectslug=XUL_School%2FUser_Notifications_and_Alerts

Since links occasionally die I'll save you some scrolling and post the code that might be most useful:

let alertsService =
  Cc["@mozilla.org/alerts-service;1"].getService(Ci.nsIAlertsService);
let title = this._bundle.getString("xulschoolhello.greeting.title");
let message = this._bundle.getString("xulschoolhello.greeting.label");

alertsService.showAlertNotification(
  "chrome://xulschoolhello/skin/hello-notification.png",
  title, message, true, "", this, "XULSchool Hello Message");

这篇关于在我的Firefox插件警报窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆