PHP trick for FxOS Manifest file

While exploring the development of a Web App for Firefox OS, I encountered a small trouble with the app manifest file: this text file needs to be served with a specific Content-Type header.

As an illustration, this is the content of the manifest of my app (JSON-formatted description of the App). It's hosted at http://é

  "name": "ImmoCalc",
  "description": "Calculatrice de prêts immobiliers",
  "launch_path": "/immocalc/index.html",
  "icons": {
    "512": "/immocalc/img/house-icon-512.png",
    "128": "/immocalc/img/house-icon-128.png",
    "60":  "/immocalc/img/house-icon-60.png"
  "developer": {
    "name": "Pierre Haessig",
    "url": ""
  "default_locale": "fr",
  "type": "web",
  "appcache_path": "/immocalc/manifest.appcache",
  "version": "1.0"

Normally, this file served as plain text. This can be seen when clicking on the link and opening the Page information dialog in Firefox (Ctrl+I). While plain text may be fine in another context, it is required that the Content-Type header is set to application/x-web-app-manifest+json. More precisely, this is required for the App submission on the Firefox Marketplace. It is recommended on MDN to tune the Apache server configuration with a .htaccess file. However, with my shared hosting plan at OVH, this was not working: the .htaccess file had no effect. [Edit: it seems to work now, so this PHP trick may not be needed anymore !].

To bypass this hosting limitation, I tried with a snippet of PHP code that simply sourcing the original manifest.webapp file, but with the proper Content-Type header.

// Serving the manifest file with the appropriate header
header('Content-type: application/x-web-app-manifest+json');

These two lines were enough to successfully submit my app on the Marketplace. The effect of the header can be seen in the browser: it triggers the Download dialog when opening the url (http://é, instead of displaying the content.

Maybe this trick can help others ?

ImmoCalc app sur Firefox Marketplace


Ma petite application mobile Calculette de prêt immobilier, dite "ImmoCalc", est désormais disponible sur le Firefox Marketplace :

Grâce à l'utilisation d'un petit fichier manifest dit appcache, le site et l'application (car c'est la même chose dans Firefox OS) devraient parfaitement fonctionner hors-ligne,  après bien sûr une première connexion pour tout télécharger. Pour cet app très simple, la techno appcache présente l'intérêt d'être simple (cf. le fichier manifest.appcache).

Petit problème : j'ai remarqué que l'installation sur Android (en utilisant un système de génération automatique d'APK, cf. Open Web Apps for Android) donne une appli qui plante au démarrage. En même temps, cette installation n'est pas très utile à partir du moment où la page web est accessible simplement, avec fonctionnement hors-ligne.

Pour information, la validation de l'app (qui est faite par un humain) a pris une petite semaine.


A small web app for house loans

house-loan-iconOver the last few weeks, I've started to play with jQuery Mobile to build a small web app for mobile phones, and in particular my new Firefox OS phone (ZTE Open C). I've built a simple interactive calculator for house loans.

For now, the app is in French only (I don't know if house loans follow the exact same rules in other countries): "Calculette de prêt immobilier".

The app is hosted for the moment at http://é and it should be usable with any recent browser (mobile, tablet or desktop). Also I may take the time to package it for the Firefox Marketplace for a true offline usage.