phonegap / phonegap-docs

PhoneGap Documentation
http://docs.phonegap.com
Apache License 2.0
121 stars 240 forks source link

[Update 0-index.html.md] Removed references to phonegap.js #286

Closed djipco closed 6 years ago

djipco commented 6 years ago

If you reference phonegap.js (instead of cordova.js) you will get a warning in the console. This error comes from this bit of code which looks specifically for "/cordova.js" (which ironically is inside the phonegap.js file injected by Phonegap Build):


function findCordovaPath() {
    var path = null;
    var scripts = document.getElementsByTagName('script');
    var term = '/cordova.js';
    for (var n = scripts.length-1; n>-1; n--) {
        var src = scripts[n].src.replace(/\?.*$/, ''); // Strip any query param (CB-6007).
        if (src.indexOf(term) == (src.length - term.length)) {
            path = src.substring(0, src.length - term.length) + '/';
            break;
        }
    }
    return path;
}

Unless someone changes the above code, the documentation should not mention phonegap.js at all because it generates a warning (which you can see from a remote debugging session). I have spent way too much time trying to figure out why I was getting this message...