![](/img/trans.png)
[英]Get the firefox browser window handle from the extension's javascript
[英]Get Browser Version From Firefox Extension
我編寫了一個Firefox擴展程序,目前正在為Firefox 4更新它並添加一些新功能。
Firefox 4有一個很棒的新通知顯示,我很想使用它,並找到了大量有關如何使用它的文檔。 但是,對於少於4的任何內容,我創建了自己的具有特定樣式的通知窗口。
我的問題是:如何在我的擴展程序的javascript中檢測我是否使用Firefox 4。 或者,有更好的方法嗎?
您可以使用nsIXULAppInfo
:
var appInfo = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULAppInfo);
// appInfo.version contains the version
您可以使用nsIVersionComparator
比較版本。
也許有更好的方法,但這絕對適合我。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.