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
As an illustration, this is the content of the manifest of my app (JSON-formatted description of the App). It's hosted at http://éole.net/immocalc/manifest.webapp.
"description": "Calculatrice de prêts immobiliers",
"name": "Pierre Haessig",
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
// Serving the manifest file with the appropriate header
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://éole.net/immocalc/manifest.webapp.php), instead of displaying the content.
Maybe this trick can help others ?