Skip to content

Instantly share code, notes, and snippets.

@videlais
Created August 21, 2014 20:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save videlais/3411484d09b1eaa42b35 to your computer and use it in GitHub Desktop.
Save videlais/3411484d09b1eaa42b35 to your computer and use it in GitHub Desktop.
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