在我的项目的config.xml中,我添加了一个自定义首选项: preference name="FooBar" value="Baz" / 然后,在我的自定义插件的JavaScript里面 plugin /www/plugin.js我想访问这个功能的值. Cordova是否将这些值暴
          <preference name="FooBar" value="Baz" />
然后,在我的自定义插件的JavaScript里面< plugin> /www/plugin.js我想访问这个功能的值.
Cordova是否将这些值暴露给JavaScript方面?我在文档中找不到任何关于它的信息.
尝试:
var argscheck = require('cordova/argscheck');
argscheck.getValue('FooBar'); // Returns just FooBar
 你可以在iOS,WP7,WP8,Windows8和Ubuntu上使用以下代码 
  
  
 function readConfig() {
    var xhr = new XMLHttpRequest();
    xhr.addEventListener("load", function () {
        var parser = new DOMParser();
        var doc = parser.parseFromString(xhr.responseText, "application/xml");
        alert("Description : " + 
              doc.getElementsByTagName("description").item(0).textContent);
    });
    xhr.open("get", "../config.xml", true);
    xhr.send();
} 
 对于Android,您必须将文件路径从“../config.xml”更改为“../../android_res/xml/config.xml”
取自Cordova邮件,其中讨论了答案:
https://www.mail-archive.com/dev@cordova.apache.org/msg14313.html
还有用于阅读配置的非官方插件:
https://github.com/apache/cordova-labs/tree/cdvtest/cordova-plugin-appsettings
