How can I launch a system command via Javascript in Google Chrome?

Posted by kvsn on Stack Overflow See other posts from Stack Overflow or by kvsn
Published on 2010-03-29T12:24:57Z Indexed on 2010/03/29 12:33 UTC
Read the original article Hit count: 284

Filed under:
|

I want to execute a local program on my computer via Javascript in Chrome. In Firefox, it can be done as follows (after setting 'signed.applets.codebase_principal_support' to true in about:config):

function run_cmd(cmd, args) {
    netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");

    var file = Components.classes["@mozilla.org/file/local;1"]
        .createInstance(Components.interfaces.nsILocalFile);
    file.initWithPath(cmd);

    var process = Components.classes["@mozilla.org/process/util;1"]
        .createInstance(Components.interfaces.nsIProcess);
    process.init(file);

    process.run(false, args, args.length);
}

What's the equivalent code for Chrome?

© Stack Overflow or respective owner

Related posts about google-chrome

Related posts about JavaScript