Skip to content

Instantly share code, notes, and snippets.

@videlais
Created Aug 21, 2014
Embed
What would you like to do?
Detecting Apache Cordova using both window.cordova and 'deviceready' event
<!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