diff options
Diffstat (limited to 'files/zh-cn/orphaned')
-rw-r--r-- | files/zh-cn/orphaned/web/api/navigator/registercontenthandler/index.html | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/files/zh-cn/orphaned/web/api/navigator/registercontenthandler/index.html b/files/zh-cn/orphaned/web/api/navigator/registercontenthandler/index.html new file mode 100644 index 0000000000..a266c55bfb --- /dev/null +++ b/files/zh-cn/orphaned/web/api/navigator/registercontenthandler/index.html @@ -0,0 +1,48 @@ +--- +title: Navigator.registerContentHandler() +slug: orphaned/Web/API/Navigator/registerContentHandler +translation_of: Web/API/Navigator/registerContentHandler +original_slug: Web/API/Navigator/registerContentHandler +--- +<div>{{ ApiRef("HTML DOM") }}</div> + +<h3 id="Summary" name="Summary">概述</h3> + +<p>Allows web sites to register themselves as possible handlers for content of a particular MIME type.</p> + +<p>{{ Note("Web sites may only register content handlers for themselves. For security reasons, it\'s not possible for an extension or web site to register content handlers targeting other sites.") }}</p> + +<h3 id="Syntax" name="Syntax">语法</h3> + +<pre class="brush: js">window.navigator.registerContentHandler(<em>mimeType</em>, <em>uri</em>, <em>title</em>); +</pre> + +<ul> + <li><code>mimeType</code> is the desired MIME type as a string.</li> + <li><code>uri</code> is the URI to the handler as a string.</li> + <li><code>title</code> is the title of the handler presented to the user as a string.</li> +</ul> + +<h3 id="Example" name="Example">例子</h3> + +<pre class="brush: js">navigator.registerContentHandler("application/vnd.mozilla.maybe.feed", + "<span class="plain">http://www.example.tld/?foo=%s</span>", + "My Feed Reader"); +</pre> + +<h3 id="Notes" name="Notes">备注</h3> + +<p>For <a href="/zh-cn/Firefox_2_for_developers" title="zh-cn/Firefox_2_for_developers">Firefox 2</a> and above, only the <code>application/vnd.mozilla.maybe.feed</code>, <code>application/atom+xml</code>, and <code>application/rss+xml</code> MIME types are supported. All values have the same effect, and the registered handler will receive feeds in all Atom and RSS versions (see {{ Bug("391286") }}).</p> + +<h3 id="Specification" name="Specification">规范</h3> + +<p>WHATWG's <a class="external" href="http://whatwg.org/specs/web-apps/current-work/#custom-handlers">Web Applications 1.0 工作草案</a></p> + +<h3 id="相关链接">相关链接</h3> + +<ul> + <li><a href="/zh-cn/Web-based_protocol_handlers" title="zh-cn/Web-based_protocol_handlers">Web-based protocol handlers</a></li> + <li><a href="/zh-cn/nsIContentHandler" title="zh-cn/nsIContentHandler">nsIContentHandler</a> (XUL only)</li> +</ul> + +<p>{{ languages( { "ja": "ja/DOM/window.navigator.registerContentHandler", "en": "en/DOM/window.navigator.registerContentHandler", "pl": "pl/DOM/window.navigator.registerContentHandler" } ) }}</p> |