aboutsummaryrefslogtreecommitdiff
path: root/files/ja/web/api/domapplicationsregistry/checkinstalled/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/ja/web/api/domapplicationsregistry/checkinstalled/index.html')
-rw-r--r--files/ja/web/api/domapplicationsregistry/checkinstalled/index.html49
1 files changed, 49 insertions, 0 deletions
diff --git a/files/ja/web/api/domapplicationsregistry/checkinstalled/index.html b/files/ja/web/api/domapplicationsregistry/checkinstalled/index.html
new file mode 100644
index 0000000000..88b7ededb5
--- /dev/null
+++ b/files/ja/web/api/domapplicationsregistry/checkinstalled/index.html
@@ -0,0 +1,49 @@
+---
+title: Apps.checkInstalled
+slug: Web/API/DOMApplicationsRegistry/checkInstalled
+tags:
+ - API
+ - Apps
+ - Apps API
+ - Firefox OS
+ - Method
+translation_of: Archive/Marketplace/API/DOMApplicationsRegistry/checkInstalled
+---
+<p>{{ ApiRef() }}</p>
+<p>{{ non-standard_header() }}</p>
+<h2 id="Summary" name="Summary">概要</h2>
+<p>指定されたアプリについての情報を取得します。これを使って、そのアプリがインストールされているかどうかを判別できます。</p>
+<h2 id="Syntax" name="Syntax">構文</h2>
+<pre><code>var request = window.navigator.mozApps.</code>checkInstalled<code>(url)</code>;
+</pre>
+<h2 id="Parameters" name="Parameters">引数</h2>
+<dl>
+ <dt>
+ <code>url</code></dt>
+ <dd>
+ アプリの <a href="/ja/docs/Web/Apps/Manifest">マニフェスト</a> の場所を含んだ <a href="/ja/docs/JavaScript/Reference/Global_Objects/String">文字列型</a> の URL。</dd>
+</dl>
+<h2 id="Returns" name="Returns">戻り値</h2>
+<p><code>checkInstalled()</code> 関数は {{ domxref("DOMRequest") }} オブジェクトを返します。<code>DOMRequest.result</code> プロパティには <a href="/ja/docs/Web/API/App"><code>App</code> オブジェクト</a> が含まれており、これはインストールされているアプリの情報を提供する JavaScript オブジェクトです。アプリがインストールされていない場合、<code>DOMRequest.result</code> は <code>null</code> となります。</p>
+<h2 id="Example" name="Example">例</h2>
+<pre class="brush: js">var request = window.navigator.mozApps.checkInstalled("http://example.com/manifest.webapp");
+request.onerror = function(e) {
+  alert("checkInstalled 呼び出しエラー: " + request.error.name);
+};
+request.onsuccess = function(e) {
+  if (request.result) {
+ console.log("アプリはインストールされています");
+ }
+ else {
+ console.log("アプリはインストールされていません");
+  }
+};</pre>
+<p>呼び出し元スクリプトは、この例のように、戻り値オブジェクトの <code>onsuccess</code>/<code>onerror</code> コールバックプロパティを設定することが期待されます。呼び出しが成功した場合、戻り値オブジェクトの <code>result</code> プロパティには <a href="/ja/docs/Web/API/App"><code>App</code> オブジェクト</a> が含まれています。この例では <code>request.result</code> に当たります。</p>
+<h2 id="Errors" name="Errors">エラー</h2>
+<p><code>DOMRequest.error</code> において文字列の <code>ERROR</code> が返ります。</p>
+<p>マニフェストが情報を要求したページとは異なるドメインにある場合、<code>checkInstalled</code> が呼び出された直後に例外 <code>NS_ERROR_DOM_BAD_URI</code> が投げられます。</p>
+<h2 id="Related_topics" name="Related_topics">関連記事</h2>
+<ul>
+ <li><a href="/ja/docs/Web/API/App"><code>App</code> オブジェクト</a></li>
+ <li><a href="/ja/docs/Web/Apps/JavaScript_API">Apps JavaScript API</a></li>
+</ul>