我實際上是在網站上添加一個按鈕來安裝網絡擴展,我想回電告訴我它是否成功。不需要Firefox的擴展安裝回調
我就翻過documentation顯示這樣做此代碼:
function xpinstallCallback(url, status)
{
if (status == 0)
msg = "XPInstall Test: PASSED\n";
else
msg = "XPInstall Test: FAILED\n";
dump(msg);
alert(msg);
}
xpi={'XPInstall Pre-Checkin Test':'pre_checkin.xpi'};
InstallTrigger.install(xpi,xpinstallCallback);
所以我建立這個模型和一些信息,我周圍聚集的淨這裏我的代碼是我的代碼:
$("#install-firefox").on('click', '.install-firefox-extension', function() {
var params = {
"Extension": { URL: "https://addons.mozilla.org/firefox/downloads/latest/example/example.xpi",
IconURL: 'https://addons.cdn.mozilla.net/user-media/addon_icons/example/example.png',
Hash: "sha256:30097adeeadcf2683e9a4aexampleaa82403aafb7faa6db9f44db657a786a4",
toString: "https://addons.mozilla.org/firefox/downloads/latest/example/example.xpi"
}
};
InstallTrigger.install(params, function(url, status) {
if (status == 0)
console.log("Extension successfully installed");
else
console.log("Extension failed");
});
});
安裝工作,我這裏的問題是沒有進入回調函數。