アプリのファイル構成
ファイル構成は以下のような形になります。
manifest.webapp以外は、通常通りのhtml, css, js になっています。
[bash]
|─ manifest.webapp
|─ index.html
|─ favicon.ico
|─ js/
|─ css/
|─ img/
[/bash]
manifest.webapp とは、
マニフェストは、Open Web App を Web サイトと区別する重要なポイントのひとつです。これはアプリの名称と説明を記載した JSON ファイルで、アプリの配信元、アイコン、そのアプリに必要な許可設定などを含めることもできます。
サンプルJSON
[js]
<pre>{
"name": "Hello World",
"description": "Hello World Firefox OS",
"launch_path": "/index.html",
"icons": {
"128": "/img/icon-128.png"
},
"developer": {
"name": "Takahiro Aiba",
"url": "http://taiba.jp/"
},
"default_locale": "ja"
}
[/js]
index.html
[html]
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Hello World</title>
</head>
<body>
<h1>Hello World!</h1>
<p>Hello Firefox OS</p>
<p><a href="http://taiba.jp/">taiba Blog</a></p>
</body>
</html>
[/html]
シュミレーターで起動
https://developer.mozilla.org/ja/Firefox_OS/Using_the_App_Manager を参考にアプリマネージャーを使いましょう。
シュミレーターで起動すると以下の様になります。