使用SSLCertificate checker插件时遇到问题。 它给出了window.plugins未定义的错误。 我从git添加了插件,并使用与git中的define相同的方式。 但我不知道我哪里出错了。 代码片段!
var app = {
// Application Constructor
initialize: function() {
document.addEventListener('deviceready', this.onDeviceReady.bind(this), false);
document.getElementById("btcon",addEventListener("click",makeconnection));
function makeconnection(){
var server = "https://build.phonegap.com";
var fingerprint = "2B 24 1B E0 D0 8C A6 41 68 C2 BB E3 60 0A DF 55 1A FC A8 45";
window.plugins.sslCertificateChecker.check(
successCallback,
errorCallback,
server,
fingerprint);
function successCallback(message) {
alert(message);
alert("Successful");
// Message is always: CONNECTION_SECURE.
// Now do something with the trusted server.
}
function errorCallback(message) {
alert(message);
if (message == "CONNECTION_NOT_SECURE") {
// There is likely a man in the middle attack going on, be careful!
alert("Connection is not secured!");
} else if (message.indexOf("CONNECTION_FAILED") >- 1) {
// There was no connection (yet). Internet may be down. Try again (a few times) after a little timeout.
alert("Connection Failed");
}
}
}
},
Git存储库链接.. https://github.com/EddyVerbruggen/SSLCertificateChecker-PhoneGap-Plugin