Created
July 14, 2017 14:57
-
-
Save chalettu/b59b4dee08c80939b2d6f0e79e49c462 to your computer and use it in GitHub Desktop.
Conditionally loading cordova
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// put this in your main.js | |
// add cordova.js only if serving the app through file:// | |
if (window.location.protocol === 'file:' || window.location.port === '3000') { | |
var cordovaScript = document.createElement('script') | |
cordovaScript.setAttribute('type', 'text/javascript') | |
cordovaScript.setAttribute('src', 'cordova.js') | |
document.body.appendChild(cordovaScript) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment