Skip to content
This repository has been archived by the owner on Jan 31, 2023. It is now read-only.

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

Merged
merged 1 commit into from Oct 30, 2018

Conversation

djipco
Copy link

@djipco djipco commented Apr 4, 2018

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...

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:

```javascript
exports.load = function(callback) {
    var pathPrefix = findCordovaPath();
    if (pathPrefix === null) {
        console.log('Could not find cordova.js script tag. Plugin loading may fail.');
        pathPrefix = '';
    }
    injectIfNecessary('cordova/plugin_list', pathPrefix + 'cordova_plugins.js', function() {
        var moduleList = require("cordova/plugin_list");
        handlePluginsObject(pathPrefix, moduleList, callback);
    }, callback);
};
```
Unless someone wants to change the above code, the documentation should not mention phonegap.js at all because it will generate a warning if you perform a remote debugging session. I have spent way too much time trying to figure out why I was getting this error!
@purplecabbage purplecabbage merged commit 72d332e into phonegap:master Oct 30, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants