Exemple Carte GPS non dynamique- Firefox OS

Création de l'application

Créer un dossier gps qui contiendra tout les scripts de votre application.

Fichier index.html :

<!doctype html>

<html>
  <head>
    <title>Carte GPS</title>
    <link rel="stylesheet" href="hello.css"/>
  </head>

  <body>
    <h1>Bonjour tout le monde</h1>
    <div id="map" style="width: 320px; height: 480px; text-indent: 0px; border-radius: 10px 10px 10px 10px;
    overflow: hidden; box-shadow: 0px 0px 5px gray; text-align: center;">
    </div>

    <p>
    <script type="text/javascript" src="http://www.openlayers.org/api/OpenLayers.js"></script>
<script type="text/javascript" defer="defer">
var map;
function init_map(lat, lon){
  /* map obj */
  map = new OpenLayers.Map('map');
  /* Adding OSM layer */ 
  map.addLayer( new OpenLayers.Layer.OSM() );
  /* Centering map */
  var localLocation = new OpenLayers.LonLat(lon,lat).transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913"));
    map.setCenter(localLocation);
    map.zoomTo(17);
}

function geo_success(position) {
  init_map(position.coords.latitude, position.coords.longitude);
}

navigator.geolocation.watchPosition(geo_success);
</script>

    </p>
  </body>
</html>

Fichier de l'icone:

Création d'un fichier manifest.webapp :

{
  "version":"1.0",
  "name":"Carte GPS",
  "description":"Carte MDL",
  "type":"web",
  "fullscreen":"true",
  "orientation": ["portrait"],
  "launch_path":"/index.html",
  "icons":
    { 
      "128":"/icon-128.png"
    },
   "developer":
   {
    "name":"Maison du Libre",
    "url":"http://mdl29.net"
    },
   "permissions":
   {
      "geolocation" : 
	{
	"description": "Nécessite l'accès GPS"
	}
   }
}