从Firefox扩展中检测操作系统

Ham*_*aya 11 firefox

我正在开发一个firefox扩展,我需要检测firefox正在运行哪个操作系统,但我似乎无法找到和如何做的信息?

Ham*_*aya 15


    // Returns "WINNT" on Windows Vista, XP, 2000, and NT systems;  
    // "Linux" on GNU/Linux; and "Darwin" on Mac OS X.  
    var osString = Components.classes["@mozilla.org/xre/app-info;1"]  
                   .getService(Components.interfaces.nsIXULRuntime).OS;  
Run Code Online (Sandbox Code Playgroud)