Beware when import cordova.js

If you would like to trigger the “deviceready” event fires when Cordova is fully loaded for some plugin usage,

document.addEventListener("deviceready", callbackFunction, false);

you need to include cordova.js in your application.

<script type="text/javascript" src="cordova.js"></script>

OK, you are done.

If you facing some unknown error in console as below even you have whitelist plugin added, cordova.js included,

Uncaught Error: Module cordova-plugin-whitelist.whitelist does not exist.
cordova.js:891 deviceready has not fired after 5 seconds.
cordova.js:884 Channel not fired: onPluginsReady
cordova.js:884 Channel not fired: onCordovaReady

then probably you include cordova.js wrongly as what I did (get from /platforms/android/assets/www/cordova.js)

<script src="asset/js/cordova.js"></script>

NOTE: You does not need to copy cordova.js from anywhere, just include as above mention will do, Cordova will figure out for u 🙂




4 thoughts on “Beware when import cordova.js

  1. When i put:

    in my index.html it gives the error: Failed to load resource
    location: file:///android_asset/www/asset/js/cordova.js
    i’m using phonegap build version cli-5.2.0

    can you help me?


    1. Do you have cordova.js generated at [YOUR_PROJECT]/platforms/android/assets/www/cordova.js when you first run “cordova platform add android” ?

      If yes, probably you just need to include the script as below in your index.html.

      <script type="text/javascript" src="cordova.js"></script>


  2. I am facing same issue, I have included cordova.js still getting error (deviceready has not fired after 5 seconds.). I am using cordova 5.4.1 with adobe push plugin for push notification. Any solution so that i can check what is preventing deviceready function.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.