diff options
Diffstat (limited to 'files/ja/web/api/navigator/useragent/index.html')
-rw-r--r-- | files/ja/web/api/navigator/useragent/index.html | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/files/ja/web/api/navigator/useragent/index.html b/files/ja/web/api/navigator/useragent/index.html new file mode 100644 index 0000000000..d02c88de43 --- /dev/null +++ b/files/ja/web/api/navigator/useragent/index.html @@ -0,0 +1,67 @@ +--- +title: Navigator.userAgent +slug: Web/API/Navigator/userAgent +tags: + - API + - Navigator + - Property + - Read-only + - Reference +browser-compat: api.Navigator.userAgent +translation_of: Web/API/NavigatorID/userAgent +original_slug: Web/API/NavigatorID/userAgent +--- +<p>{{ApiRef("HTML DOM")}}</p> + +<p><code><strong>NavigatorID.userAgent</strong></code> は読み取り専用のプロパティで、現在のブラウザーのユーザーエージェント文字列を返します。</p> + +<div class="note"> +<p>仕様書では、ブラウザーがこのフィールドを介して提供する情報をできるだけ少なくすることを求めています。このプロパティの値は、同じブラウザーの将来のバージョンでも同じままであると仮定してはいけません。まったく使用しないようにしたり、ブラウザーの現在のバージョンと過去のバージョンのためだけに使用するようにしてください。新しいブラウザーは、古いブラウザーと同じ UA、またはその一部を使い始めるかもしれません。ブラウザーエージェントが本当にこのプロパティによって広告されたものであるという保証は本当にありません。<br> +<br> +また、ブラウザーのユーザーはこのフィールドの値を変更することができることを覚えておいてください (UA なりすまし)。</p> +</div> + +<p>ユーザーエージェント文字列の検出に基づくブラウザーの識別は<strong>信頼性が低く</strong>、ユーザーエージェント文字列はユーザーが設定可能なので<strong>推奨されません</strong>。例えば、以下のようになります。</p> + +<ul> + <li>Firefox では、 about:config の "general.useragent.override" 設定を使うことができます。いくつかの Firefox の拡張や多機能バーでも設定可能です。</li> + <li>Opera 6 以降では、メニューからブラウザー識別文字列を設定できます。</li> + <li>Microsoft Internet Explorer では、 Windows レジストリーを使用します。</li> + <li>Safari と iCab は、メニューから、ブラウザーユーザエージェントを定義済みの Internet Explorer、または、 Netscape の文字列に変更できます。</li> +</ul> + +<h2 id="Syntax">構文</h2> + +<pre class="brush: js">var <var>ua</var> = navigator.userAgent; +</pre> + +<h3 id="Value">値</h3> + +<p>{{domxref("DOMString")}} で、ブラウザーが {{Glossary("HTTP")}} ヘッダーで提供する完全なユーザーエージェント文字列と、 {{domxref("Navigator")}} オブジェクト上のメソッドやその他の関連メソッドへのレスポンスを指定します。</p> + +<p>ユーザーエージェント文字列は形式的な構造に基づいて構築されており、いくつかの情報に分解することができます。これらの情報の各部分は、ユーザ-が設定可能な他の Navigator のプロパティから来ています。Gecko ベースのブラウザは以下の一般的な構造に準拠しています。</p> + +<pre class="brush: js">userAgent = appCodeName/appVersion number (Platform; Security; OS-or-CPU; +Localization; rv: revision-version-number) product/productSub +Application-Name Application-Name-version +</pre> + +<h2 id="Example">例</h2> + +<pre class="brush:js">alert(window.navigator.userAgent) +// alerts "Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.2) Gecko/20010725 Netscape6/6.1" +</pre> + +<h2 id="Specifications">仕様書</h2> + +{{Specifications}} + +<h2 id="Browser_compatibility">ブラウザーの互換性</h2> + +<p>{{Compat}}</p> + +<h2 id="See_also">関連情報</h2> + +<ul> + <li>{{httpheader("User-Agent")}} HTTP ヘッダー</li> +</ul> |