Detecting Apache Cordova using both window.cordova and 'deviceready' event
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Device Ready Example</title> | |
<script type="text/javascript" charset="utf-8" src="cordova.js"></script> | |
<script type="text/javascript" charset="utf-8"> | |
var isCordovaApp = (typeof window.cordova !== "undefined"); | |
if(isCordovaApp) { | |
document.addEventListener("deviceready", loadProject, false); | |
} else { | |
loadProject(); | |
} | |
function loadProject() { | |
//Load project code here. | |
} | |
</script> | |
</head> | |
<body> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment