var currentRunningVersionCompareTo30 = Services.vc.compare(Services.appinfo.version, 30);
if (currentRunningVersionCompareTo30 < 0) {
Services.prompt.alert(null, 'Version Compare Result', 'You are running Firefox ' + Services.appinfo.version + ' and this add-on was designed for optimal performance in at least Firefox 30');
} else if (currentRunningVersionCompareTo30 == 0) {
Services.prompt.alert(null, 'Version Compare Result', 'You are running Firefox 30, I designed this add-on for FF30 kewl!');
} else if (currentRunningVersionCompareTo30 > 0) {
Services.prompt.alert(null, 'Version Compare Result', 'You are running Firefox ' + Services.appinfo.version + ' you are way ahead of me! I made this add-on using Firefox 30...');
}
1 回答
或者使用在他的评论中链接的@canuckistani函数