Pages

Thursday, February 27, 2014

Convert Your Site into a Firefox OS App

Open web apps are here thanks to Firefox OS, which makes it possible to build apps with only HTML, Javascript and CSS.
This is a great advantage for web developers who don't want to code for iOS or Android devices.
In this tutorial, we'll show you how to convert your existing responsive website into an app that can run on Firefox OS devices.

Step #1. HTML file

  • Create a file named index.html with the following code:
01.<!DOCTYPE html>
02.<html>
03.<head>
04.<meta charset="utf-8">
05.<title>OSTraining Blog</title>
06.<meta name="description" content="">
07.<meta name="viewport" content="width=device-width">   
08.<meta http-equiv="refresh" content="5;url=http://www.oktamam.in">   
09.</head>
10.<body>
11.<p>Loading...</p>
12.</body>
13.</html>
  • In the previous code, replace http://www.oktamam.in with your own URL
  • Replace 5 (seconds) with the loading time to display the message: "Loading..."

Step #2. Icon images

  • Create 3 .png images. These will need to be of different sizes for use on different devices. We're going to create icons that 16x16, 48x48 and 128x128.
  • Create a folder called /img/ and place the images inside.
website firefox os app

Step #3. Manifest file

  • Create a file called manifest.webapp and add the following code:
01.{
02."version""1.0.0",
03."name""OSTraining Blog",
04."description""Blog post and tutorial about web development",
05."launch_path""/index.html",
06."icons": {
07."16""/img/icon-16.png",
08."48""/img/icon-48.png",
09."128""/img/icon-128.png"
10.},
11."developer": {
12."name""Valentin Garcia",
13."url""http://www.oktamam.in"
14.}
15.}
  • Version: is the software control for the app
  • Name: the name of your app
  • Launch pat: should point this to your index.html file
  • Icons: you can set the icons path
  • Developer: your developer name and URL

Step #4. Create the install package

  • Create a zip file with your files inside:
website firefox os app

Step #5. Submit your app

  • The final step is send the zip file to Firefox Marketplace.
  • If you don't have an account, create one and login. Then go to Developers page >> Submit An App.
  • Once you complete the form and upload the zip file, you need to wait for the review and approval. This may take from hours to days.

No comments:

Post a Comment

Thanks for your comment.