In this section, we will work on making our hosted application installable so that users who visit our application through the web browser on their Firefox OS mobiles are provided with an option to install the application on their phones, as shown in the following screenshot:
The Install App button will only show up if the user opens the application on Firefox OS. When the user loads the website on a desktop browser, we will keep the button hidden. We will also keep it hidden when the hosted web application that the user opens is already installed on their device.
We need to make changes in our clickr.js
file in order to add the Install button. You will notice a new property under the clickr object named manifest_url
that needs to be set to null
. There is a new function called install()
, where the variable installLocFind
installs the application. If it returns a success
, which means the application has been successfully installed, then it will hide the...