Created
August 6, 2015 06:33
-
-
Save qq99/a58995f43db778df38c0 to your computer and use it in GitHub Desktop.
Example of simple HTML file to install a fxos app
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> | |
<head> | |
<script> | |
function installApplication () { | |
var manifestLocation = window.location.protocol + "//" + window.location.host + "/manifest.webapp"; | |
console.log("Attempting to install from", manifestLocation); | |
var installApp = navigator.mozApps.install(manifestLocation); | |
// Successful install | |
installApp.onsuccess = function(data) { | |
console.log("Success, app installed!"); | |
}; | |
// Install failed | |
installApp.onerror = function() { | |
console.log("Install failed\n\n:" + installApp.error.name); | |
}; | |
} | |
</script> | |
</head> | |
<body> | |
<button onclick="installApplication()">Install</button> | |
</body> | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment