Network Working Group                                         D. Eastlake
Request for Comments: 2936                                       Motorola
Category: Informational                                          C. Smith
                                                     Royal Bank of Canada
                                                                D. Soroka
                                                                      IBM
                                                           September 2000
        
Network Working Group                                         D. Eastlake
Request for Comments: 2936                                       Motorola
Category: Informational                                          C. Smith
                                                     Royal Bank of Canada
                                                                D. Soroka
                                                                      IBM
                                                           September 2000
        

HTTP MIME Type Handler Detection

HTTP MIME类型处理程序检测

Status of this Memo

本备忘录的状况

This memo provides information for the Internet community. It does not specify an Internet standard of any kind. Distribution of this memo is unlimited.

本备忘录为互联网社区提供信息。它没有规定任何类型的互联网标准。本备忘录的分发不受限制。

Copyright Notice

版权公告

Copyright (C) The Internet Society (2000). All Rights Reserved.

版权所有(C)互联网协会(2000年)。版权所有。

Abstract

摘要

Entities composing web pages to provide services over the Hypertext Transfer Protocol (HTTP) frequently have the problem of not knowing what Multipurpose Internet Mail Extensions (MIME) types have handlers installed at a user's browser. For example, whether an Internet Open Trading Protocol (IOTP) or VRML or SET or some streaming media handler is available. In some cases they would want to display different web pages or content depending on a MIME handler's availability. This document summarizes reasonable techniques to solve this problem for most of the browsers actually deployed on the Internet as of early 2000. It is intended to be of practical use to implementors during the period before the wide deployment of superior standards based techniques which may be developed.

组成网页以通过超文本传输协议(HTTP)提供服务的实体经常存在不知道用户浏览器上安装了哪些多用途Internet邮件扩展(MIME)类型的处理程序的问题。例如,互联网开放交易协议(IOTP)或VRML或SET或某些流媒体处理程序是否可用。在某些情况下,他们希望根据MIME处理程序的可用性显示不同的网页或内容。本文档总结了在2000年初实际部署在Internet上的大多数浏览器解决此问题的合理技术。其目的是在广泛部署可能开发的基于高级标准的技术之前,对实施者具有实际用途。

Acknowledegements

承认

Helpful comments by Tony Lewis of Visa have been incorporated.

Visa国际组织的托尼·刘易斯(Tony Lewis)的有益评论已被纳入其中。

Table of Contents

目录

   1. Introduction.................................................  2
   2. The HTTP 'Accept' Header.....................................  2
   3. JavaScript...................................................  3
   4. ActiveX and the Windows Registry.............................  4
   5. ECML, The Electronic Commerce Modeling Language..............  4
   6. Putting It All Together......................................  5
   7. Future Development...........................................  5
   8. Security Considerations......................................  5
   9. IANA Considerations..........................................  6
   References......................................................  6
   Appendix A: Browser Version Sniffer Code........................  8
   Authors' Addresses.............................................. 12
   Full Copyright Statement........................................ 13
        
   1. Introduction.................................................  2
   2. The HTTP 'Accept' Header.....................................  2
   3. JavaScript...................................................  3
   4. ActiveX and the Windows Registry.............................  4
   5. ECML, The Electronic Commerce Modeling Language..............  4
   6. Putting It All Together......................................  5
   7. Future Development...........................................  5
   8. Security Considerations......................................  5
   9. IANA Considerations..........................................  6
   References......................................................  6
   Appendix A: Browser Version Sniffer Code........................  8
   Authors' Addresses.............................................. 12
   Full Copyright Statement........................................ 13
        
1. Introduction
1. 介绍

Entities composing web pages to provide services over [HTTP] frequently have the problem of not knowing what [MIME] types have handlers installed at a user's browser. For example, whether an [IOTP] or VRML or [SET] or some streaming media handler is available. In many cases they would want to display different web pages or content depending on a MIME handler's availability. Sending a response with a MIME type that is not supported frequently results in interrupting the flow of the user experience, browser queries as to what to do with the data being provided, and, of course, failure to provide the behavior that would have occurred had the correct MIME type handler been installed.

组成网页以通过[HTTP]提供服务的实体经常会遇到不知道用户浏览器中安装了哪些[MIME]类型的处理程序的问题。例如,[IOTP]或VRML或[SET]或某些流媒体处理器是否可用。在许多情况下,他们希望根据MIME处理程序的可用性显示不同的网页或内容。发送带有不受支持的MIME类型的响应通常会中断用户体验流、浏览器询问如何处理所提供的数据,当然,如果安装了正确的MIME类型处理程序,则无法提供可能发生的行为。

This document describes reasonable techniques to solve this problem for most of the browsers actually deployed on the Internet as of early 2000. It is intended to be of practical use to implementors during the period before the wide deployment of superior standards based techniques which may be developed. It is written in terms of determining whether a handler for application/iotp or application/x-iotp exists but is equally applicable to other MIME types.

本文档描述了解决此问题的合理技术,这些技术适用于2000年初实际部署在Internet上的大多数浏览器。其目的是在广泛部署可能开发的基于高级标准的技术之前,对实施者具有实际用途。它是根据确定应用程序/iotp或应用程序/x-iotp的处理程序是否存在而编写的,但同样适用于其他MIME类型。

2. The HTTP 'Accept' Header
2. HTTP“接受”标头

The problem should be solved by the Hyper Text Transport Protocol [HTTP] request "Accept" header which lists accepted [MIME] types. This header is present in both Version 1.0 and 1.1 of HTTP and its content is supposed to be a list of MIME types and subtypes that are accepted. The only problem is that many browsers just send "*/*" or the like.

这个问题应该通过超文本传输协议[HTTP]请求“接受”头来解决,该头列出了接受的[MIME]类型。此标头在HTTP的1.0版和1.1版中都存在,其内容应该是被接受的MIME类型和子类型的列表。唯一的问题是许多浏览器只发送“*/*”之类的内容。

If the particular MIME type you are looking for is specifically present in the Accept header, it is generally safe to assume that a handler for it is actually installed or part of the browser.

如果您要查找的特定MIME类型在Accept标头中明确存在,则通常可以安全地假定它的处理程序已实际安装或是浏览器的一部分。

NOTE: Although not part of the main topic of this document, if you are designing MIME type handler software and have access to a browser interface that allows you to request the insertion of the MIME type or types your software handles into the Accept header, you generally should do so. It will make it easier for servers sensitive to that MIME type to respond correctly.

注意:虽然不是本文档主要主题的一部分,但如果您正在设计MIME类型处理程序软件,并且可以访问允许您请求将MIME类型或软件处理程序的类型插入Accept标头的浏览器界面,则通常应这样做。这将使对该MIME类型敏感的服务器更容易正确响应。

3. JavaScript
3. JavaScript

Most recent browsers support one or more scripting languages of which the most widely deployed is "JavaScript". These scripting languages appear in web pages and permit the interpretive execution of programming language constructs that can probe the browser environment, conditionally cause different page contents to be displayed, etc. For example, Appendix A shows JavaScript available from the Netscape web site for determining what operating system, browser, and version on which a web page is appearing.

最新的浏览器支持一种或多种脚本语言,其中部署最广泛的是“JavaScript”。这些脚本语言出现在网页中,并允许解释性地执行编程语言结构,这些语言结构可以探测浏览器环境,有条件地显示不同的页面内容等。例如,附录A显示了Netscape网站提供的JavaScript,用于确定什么操作系统、浏览器、,和显示网页的版本。

NOTE: JavaScript is a trademark of SUN Microsystems, Inc. It was originally called LiveScript. It has nothing to do with the Java language.

注意:JavaScript是SUN Microsystems,Inc.的商标。它最初被称为LiveScript。它与Java语言无关。

The syntax for script use appears to be a Hyper Text Markup Language (HTML) comment so that browsers that do not support scripting will ignore such items. That is, script use is preceded by "<!--" and terminated by "-->". The following is a simple example of conditional execution of parts of a web page based on JavaScript MIME type handler detection.

脚本使用的语法似乎是超文本标记语言(HTML)注释,因此不支持脚本的浏览器将忽略此类项目。也就是说,脚本使用前加“<!--”并以“->”终止。下面是一个基于JavaScript MIME类型处理程序检测的web页面部分条件执行的简单示例。

   <SCRIPT LANGUAGE=JAVASCRIPT>
   <!-- hide it
   if (navigator.mimeTypes && navigator.mimeTypes.length > 0) {
     if ( navigator.mimeTypes["application/iotp"] ||
          navigator.mimeTypes["application/x-iotp"]) {
       // here if IOTP handler exists
       }
     else {
       // here if IOTP handler does not exist
       }
     }
   // end and hide -->
   </SCRIPT>
        
   <SCRIPT LANGUAGE=JAVASCRIPT>
   <!-- hide it
   if (navigator.mimeTypes && navigator.mimeTypes.length > 0) {
     if ( navigator.mimeTypes["application/iotp"] ||
          navigator.mimeTypes["application/x-iotp"]) {
       // here if IOTP handler exists
       }
     else {
       // here if IOTP handler does not exist
       }
     }
   // end and hide -->
   </SCRIPT>
        
4. ActiveX and the Windows Registry
4. ActiveX与Windows注册表

If running on Microsoft Windows Internet Explorer version 3 or 4, it is necessary to query the Windows Registry to determine local MIME type support. Although these broswers support JavaScript, in v3 the mimeTypes array is not present and in v4 the mimeTypes array is present but always empty. For example, executing the following code will test for support of the IOTP types:

如果在Microsoft Windows Internet Explorer版本3或4上运行,则需要查询Windows注册表以确定本地MIME类型支持。尽管这些浏览器支持JavaScript,但在v3中不存在mimeTypes数组,在v4中存在mimeTypes数组,但始终为空。例如,执行以下代码将测试对IOTP类型的支持:

   CString iotpString, xiotpString;
   char* Key, Keyx;
        
   CString iotpString, xiotpString;
   char* Key, Keyx;
        
      int rc, rcx;
      iotpString =
   "SOFTWARE\Classes\MIME\Database\Content Type\application/iotp";
      xiotpString =
   "SOFTWARE\Classes\MIME\Database\Content Type\application/x-iotp";
      Key = iotpString.GetBuffer(1);
      Keyx = xiotpString.GetBuffer(1);
      rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, Key, 0, KEY_READ, hDefKey);
      rcx = RegOpenKeyEx(HKEY_LOCAL_MACHINE, Keyx, 0, KEY_READ, hDefKey);
   if ( ( rc  == ERROR_SUCCESS ) || ( rcx == ERROR_SUCCESS ) )
    {
    // IOTP Handler exists
    }
   else
    {
    // No IOTP Handler
    }
        
      int rc, rcx;
      iotpString =
   "SOFTWARE\Classes\MIME\Database\Content Type\application/iotp";
      xiotpString =
   "SOFTWARE\Classes\MIME\Database\Content Type\application/x-iotp";
      Key = iotpString.GetBuffer(1);
      Keyx = xiotpString.GetBuffer(1);
      rc = RegOpenKeyEx(HKEY_LOCAL_MACHINE, Key, 0, KEY_READ, hDefKey);
      rcx = RegOpenKeyEx(HKEY_LOCAL_MACHINE, Keyx, 0, KEY_READ, hDefKey);
   if ( ( rc  == ERROR_SUCCESS ) || ( rcx == ERROR_SUCCESS ) )
    {
    // IOTP Handler exists
    }
   else
    {
    // No IOTP Handler
    }
        

NOTE: ActiveX is a trademark of Microsoft and was originally called Sweeper.

注意:ActiveX是Microsoft的商标,最初称为Sweeper。

5. ECML, The Electronic Commerce Modeling Language
5. 电子商务建模语言ECML

A industry group has recently proposed a standard for fields used in electronic commerce. This fields allow "wallet" software acting for the consumer to convey standardized information to a merchant, including information as to what payment related protocols are supported at the customer site. See [ECML].

一个行业团体最近提出了一个电子商务领域的标准。此字段允许代表消费者的“钱包”软件向商户传递标准化信息,包括关于客户站点支持哪些支付相关协议的信息。见[ECML]。

6. Putting It All Together
6. 把它们放在一起

The following diagram indicates how these techniques can be put together.

下图说明了如何将这些技术组合在一起。

   start>-----+
              |
      +------------------+
      | Was desired type |     NO      +-------------------------+
      |found in Accept?  |------------>| Is JavaScript available |
      +------------------+             |and does it show type?   |
            |                          +-------------------------+
       YES  |                            |         |           |
            |<---------------------------+         |        NO |
            |        YES                           |           |
            |                      +---<explorer<--+           |
            |                      |                           |
            |          +----------------------+                |
            |          | Is ActiveX available |                |
            |          |and does it show type?|                |
            |          +----------------------+                |
            |  YES       |        |         |             NO   |
            |<-----------+        |         +----------------->|
            |                     V                            |
   remember |               Indeterminate.            remember |
     that   |.              Take default             that type |
   type IS  |               action.                     is NOT |
   supported|                                        supported |
            X done                                             X
        
   start>-----+
              |
      +------------------+
      | Was desired type |     NO      +-------------------------+
      |found in Accept?  |------------>| Is JavaScript available |
      +------------------+             |and does it show type?   |
            |                          +-------------------------+
       YES  |                            |         |           |
            |<---------------------------+         |        NO |
            |        YES                           |           |
            |                      +---<explorer<--+           |
            |                      |                           |
            |          +----------------------+                |
            |          | Is ActiveX available |                |
            |          |and does it show type?|                |
            |          +----------------------+                |
            |  YES       |        |         |             NO   |
            |<-----------+        |         +----------------->|
            |                     V                            |
   remember |               Indeterminate.            remember |
     that   |.              Take default             that type |
   type IS  |               action.                     is NOT |
   supported|                                        supported |
            X done                                             X
        
7. Future Development
7. 未来发展

Active work is proceeding in the IETF, World Wide Web Consortium [W3C], and other standards and industry groups concerning content and capabilities negotiation. This work is likely to lead to superior methods to implement the functionality described herein. However, near universal deployment of such new standards/features will take some time. Thus you should expect the methods given herein to be obsoleted, but perhaps not for some time.

IETF、万维网联盟[W3C]以及其他标准和行业团体正在积极开展有关内容和能力协商的工作。这项工作可能会产生更好的方法来实现本文所述的功能。然而,这类新标准/功能的几乎普遍部署将需要一些时间。因此,您应该预期本文给出的方法将被淘汰,但可能不会在一段时间内淘汰。

8. Security Considerations
8. 安全考虑

It should be noted that the variety of ActiveX control suggested above is reading the user's registry, that is, examining their computer and reporting back some information it has discovered. This may be a concern among some users.

应该注意的是,上面建议的各种ActiveX控件都是读取用户的注册表,也就是说,检查他们的计算机并报告它发现的一些信息。这可能是一些用户关心的问题。

In general, the use of JavaScript and, even more so, ActiveX is dangerous because they are so powerful. JavaScript or ActiveX from a web page could be invisibly damaging to the client.

一般来说,使用JavaScript,甚至ActiveX都是危险的,因为它们功能强大。网页中的JavaScript或ActiveX可能会对客户端造成无形的损害。

Security of web interactions is normally provided by adopting channel encryption on the browser to server connections, such as [TLS]. In the absence of some such additional security outside of HTTP, requests and/or responses may be forged or tampered with.

web交互的安全性通常通过在浏览器到服务器的连接(如[TLS])上采用通道加密来提供。在HTTP之外缺乏一些此类附加安全性的情况下,请求和/或响应可能被伪造或篡改。

9. IANA Considerations
9. IANA考虑

None specific to the techniques described herein. For MIME types and type registration procedures, see [MIME: RFCs 2046, 2048].

没有特定于本文描述的技术。有关MIME类型和类型注册过程,请参阅[MIME:RFCs 20462048]。

References

工具书类

[ECML] Eastlake, D. and T. Goldstein, "ECML v1: Field Names for E-Commerce", RFC 2706, October 1999.

[ECML]Eastlake,D.和T.Goldstein,“ECML v1:电子商务领域名称”,RFC 2706,1999年10月。

[HTTP] Berners-Lee, T., Fielding, R. and H. Frystyk, "Hypertext Transfer Protocol -- HTTP/1.0", RFC 1945, May 1996.

[HTTP]Berners Lee,T.,Fielding,R.和H.Frystyk,“超文本传输协议——HTTP/1.0”,RFC 1945,1996年5月。

[HTTP] Fielding, R., Gettys, J., Mogul, J., Frystyk, H., Masinter, L., Leach, P. and T. Berners-Lee, "Hypertext Transfer Protocol -- HTTP/1.1", RFC 2616, June 1999.

[HTTP]菲尔丁,R.,盖蒂斯,J.,莫卧儿,J.,弗莱斯蒂克,H.,马斯泰尔,L.,利奇,P.和T.伯纳斯李,“超文本传输协议——HTTP/1.1”,RFC 26161999年6月。

[IOTP] Burdett, D., "Internet Open Trading Protocol - IOTP Version 1.0", RFC 2801, April 2000.

[IOTP]Burdett,D.,“互联网开放交易协议-IOTP版本1.0”,RFC2801,2000年4月。

[MIME] Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part One: Format of Internet Message Bodies", RFC 2045, November 1996.

[MIME]Freed,N.和N.Borenstein,“多用途Internet邮件扩展(MIME)第一部分:Internet邮件正文格式”,RFC 20451996年11月。

[MIME] Freed, N. and N. Borenstein, "Multipurpose Internet Mail Extensions (MIME) Part Two: Media Types", RFC 2046, November 1996.

[MIME]Freed,N.和N.Borenstein,“多用途互联网邮件扩展(MIME)第二部分:媒体类型”,RFC 20461996年11月。

[MIME] Moore, K., "MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text", RFC 2047, November 1996.

[MIME]Moore,K.,“MIME(多用途互联网邮件扩展)第三部分:非ASCII文本的消息头扩展”,RFC 2047,1996年11月。

[MIME] Freed, N., Klensin, J. and J. Postel, "Multipurpose Internet Mail Extensions (MIME) Part Four: Registration Procedures", RFC 2048, November 1996.

[MIME]Freed,N.,Klensin,J.和J.Postel,“多用途互联网邮件扩展(MIME)第四部分:注册程序”,RFC 20481996年11月。

   [SET]  "Secure Electronic Transaction (SET) Specification, Version
          1.0", May 31, 1997, available from <http://www.setco.org>.
             Book 1: Business Description
             Book 2: Programmer's Guide
             Book 3: Formal Protocol Definition
        
   [SET]  "Secure Electronic Transaction (SET) Specification, Version
          1.0", May 31, 1997, available from <http://www.setco.org>.
             Book 1: Business Description
             Book 2: Programmer's Guide
             Book 3: Formal Protocol Definition
        

[TLS] Dierks, T. and C. Allen, "The TLS Protocol Version 1.0", RFC 2246, January 1999.

[TLS]Dierks,T.和C.Allen,“TLS协议版本1.0”,RFC 2246,1999年1月。

[W3C] World Wide Web Consortium, <www.w3.org>

[W3C]万维网联盟,<www.w3.org>

Appendix A: Browser Version Sniffer Code

附录A:浏览器版本嗅探器代码

  <SCRIPT LANGUAGE="JavaScript">
  <!-- hide JavaScript from non-JavaScript browsers
  // Ultimate client-side JavaScript client sniff.
  // (C) Netscape Communications 1999.
  //     Permission granted to reuse and distribute.
  // Revised 17 May 99 to add is_nav5up and is_ie5up (see below).
        
  <SCRIPT LANGUAGE="JavaScript">
  <!-- hide JavaScript from non-JavaScript browsers
  // Ultimate client-side JavaScript client sniff.
  // (C) Netscape Communications 1999.
  //     Permission granted to reuse and distribute.
  // Revised 17 May 99 to add is_nav5up and is_ie5up (see below).
        
  // Everything you always wanted to know about your JavaScript client
  // but were afraid to ask. Creates "is_" variables indicating:
  // (1) browser vendor:
  //     is_nav, is_ie, is_opera
  // (2) browser version number:
  //     is_major (integer indicating major version number: 2, 3, 4 ...)
  //     is_minor (float   indicating full  version number:
  //                                               2.02, 3.01, 4.04 ...)
  // (3) browser vendor AND major version number
  //     is_nav2, is_nav3, is_nav4, is_nav4up, is_nav5, is_nav5up,
  //     is_ie3, is_ie4, is_ie4up
  // (4) JavaScript version number:
  //     is_js (float indicating full JavaScript version number:
  //                                                    1, 1.1, 1.2 ...)
  // (5) OS platform and version:
  //     is_win, is_win16, is_win32, is_win31,
  //     is_win95, is_winnt, is_win98
  //     is_os2
  //     is_mac, is_mac68k, is_macppc
  //     is_unix
  //        is_sun, is_sun4, is_sun5, is_suni86
  //        is_irix, is_irix5, is_irix6
  //        is_hpux, is_hpux9, is_hpux10
  //        is_aix, is_aix1, is_aix2, is_aix3, is_aix4
  //        is_linux, is_sco, is_unixware, is_mpras, is_reliant
  //        is_dec, is_sinix, is_freebsd, is_bsd
  //     is_vms
  //
  // See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
  // http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
  // for detailed lists of userAgent strings.
  //
  // Note: you don't want your Nav4 or IE4 code to "turn off" or
  // stop working when Nav5 and IE5 (or later) are released, so
  // in conditional code forks, use is_nav4up ("Nav4 or greater")
  // and is_ie4up ("IE4 or greater") instead of is_nav4 or is_ie4
  // to check version in code which you want to work on future
  // versions.
        
  // Everything you always wanted to know about your JavaScript client
  // but were afraid to ask. Creates "is_" variables indicating:
  // (1) browser vendor:
  //     is_nav, is_ie, is_opera
  // (2) browser version number:
  //     is_major (integer indicating major version number: 2, 3, 4 ...)
  //     is_minor (float   indicating full  version number:
  //                                               2.02, 3.01, 4.04 ...)
  // (3) browser vendor AND major version number
  //     is_nav2, is_nav3, is_nav4, is_nav4up, is_nav5, is_nav5up,
  //     is_ie3, is_ie4, is_ie4up
  // (4) JavaScript version number:
  //     is_js (float indicating full JavaScript version number:
  //                                                    1, 1.1, 1.2 ...)
  // (5) OS platform and version:
  //     is_win, is_win16, is_win32, is_win31,
  //     is_win95, is_winnt, is_win98
  //     is_os2
  //     is_mac, is_mac68k, is_macppc
  //     is_unix
  //        is_sun, is_sun4, is_sun5, is_suni86
  //        is_irix, is_irix5, is_irix6
  //        is_hpux, is_hpux9, is_hpux10
  //        is_aix, is_aix1, is_aix2, is_aix3, is_aix4
  //        is_linux, is_sco, is_unixware, is_mpras, is_reliant
  //        is_dec, is_sinix, is_freebsd, is_bsd
  //     is_vms
  //
  // See http://www.it97.de/JavaScript/JS_tutorial/bstat/navobj.html and
  // http://www.it97.de/JavaScript/JS_tutorial/bstat/Browseraol.html
  // for detailed lists of userAgent strings.
  //
  // Note: you don't want your Nav4 or IE4 code to "turn off" or
  // stop working when Nav5 and IE5 (or later) are released, so
  // in conditional code forks, use is_nav4up ("Nav4 or greater")
  // and is_ie4up ("IE4 or greater") instead of is_nav4 or is_ie4
  // to check version in code which you want to work on future
  // versions.
        
  // convert all characters to lowercase to simplify testing
  var agt=navigator.userAgent.toLowerCase();
        
  // convert all characters to lowercase to simplify testing
  var agt=navigator.userAgent.toLowerCase();
        
  // *** BROWSER VERSION ***
  // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
  var is_major = parseInt(navigator.appVersion);
  var is_minor = parseFloat(navigator.appVersion);
        
  // *** BROWSER VERSION ***
  // Note: On IE5, these return 4, so use is_ie5up to detect IE5.
  var is_major = parseInt(navigator.appVersion);
  var is_minor = parseFloat(navigator.appVersion);
        
  // Note: Opera and WebTV spoof Navigator.  We do strict client
  //  detection.  If you want to allow spoofing, take out the tests
  //  for opera and webtv.
  var is_nav  = ((agt.indexOf('mozilla')!=-1)
              && (agt.indexOf('spoofer')==-1)
              && (agt.indexOf('compatible') == -1)
              && (agt.indexOf('opera')==-1)
              && (agt.indexOf('webtv')==-1));
  var is_nav2 = (is_nav && (is_major == 2));
  var is_nav3 = (is_nav && (is_major == 3));
  var is_nav4 = (is_nav && (is_major == 4));
  var is_nav4up = (is_nav && (is_major >= 4));
  var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                        (agt.indexOf("; nav") != -1)) );
  var is_nav5 = (is_nav && (is_major == 5));
  var is_nav5up = (is_nav && (is_major >= 5));
        
  // Note: Opera and WebTV spoof Navigator.  We do strict client
  //  detection.  If you want to allow spoofing, take out the tests
  //  for opera and webtv.
  var is_nav  = ((agt.indexOf('mozilla')!=-1)
              && (agt.indexOf('spoofer')==-1)
              && (agt.indexOf('compatible') == -1)
              && (agt.indexOf('opera')==-1)
              && (agt.indexOf('webtv')==-1));
  var is_nav2 = (is_nav && (is_major == 2));
  var is_nav3 = (is_nav && (is_major == 3));
  var is_nav4 = (is_nav && (is_major == 4));
  var is_nav4up = (is_nav && (is_major >= 4));
  var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
                        (agt.indexOf("; nav") != -1)) );
  var is_nav5 = (is_nav && (is_major == 5));
  var is_nav5up = (is_nav && (is_major >= 5));
        
  var is_ie   = (agt.indexOf("msie") != -1);
  var is_ie3  = (is_ie && (is_major < 4));
  var is_ie4  = (is_ie && (is_major == 4)
                       && (agt.indexOf("msie 5.0")==-1) );
  var is_ie4up  = (is_ie  && (is_major >= 4));
  var is_ie5  = (is_ie && (is_major == 4)
                       && (agt.indexOf("msie 5.0")!=-1) );
  var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);
        
  var is_ie   = (agt.indexOf("msie") != -1);
  var is_ie3  = (is_ie && (is_major < 4));
  var is_ie4  = (is_ie && (is_major == 4)
                       && (agt.indexOf("msie 5.0")==-1) );
  var is_ie4up  = (is_ie  && (is_major >= 4));
  var is_ie5  = (is_ie && (is_major == 4)
                       && (agt.indexOf("msie 5.0")!=-1) );
  var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4);
        
  // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
  // or if this is the first browser window opened.  Thus the
  // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.
  var is_aol   = (agt.indexOf("aol") != -1);
  var is_aol3  = (is_aol && is_ie3);
  var is_aol4  = (is_aol && is_ie4);
        
  // KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
  // or if this is the first browser window opened.  Thus the
  // variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.
  var is_aol   = (agt.indexOf("aol") != -1);
  var is_aol3  = (is_aol && is_ie3);
  var is_aol4  = (is_aol && is_ie4);
        
  var is_opera = (agt.indexOf("opera") != -1);
  var is_webtv = (agt.indexOf("webtv") != -1);
        
  var is_opera = (agt.indexOf("opera") != -1);
  var is_webtv = (agt.indexOf("webtv") != -1);
        
  // *** JAVASCRIPT VERSION CHECK ***
  var is_js;
  if (is_nav2 || is_ie3) is_js = 1.0
  else if (is_nav3 || is_opera) is_js = 1.1
        
  // *** JAVASCRIPT VERSION CHECK ***
  var is_js;
  if (is_nav2 || is_ie3) is_js = 1.0
  else if (is_nav3 || is_opera) is_js = 1.1
        
  else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2
  else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3
  else if (is_nav5) is_js = 1.4
  // NOTE: In the future, update this code when newer versions of JS
  // are released. For now, we try to provide some upward compatibility
  // so that future versions of Nav and IE will show they are at
  // *least* JS 1.x capable. Always check for JS version compatibility
  // with > or >=.
  else if (is_nav && (is_major > 5)) is_js = 1.4
  else if (is_ie && (is_major > 5)) is_js = 1.3
  // HACK: no idea for other browsers;
  //       always check for JS version with > or >=
  else is_js = 0.0;
        
  else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2
  else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3
  else if (is_nav5) is_js = 1.4
  // NOTE: In the future, update this code when newer versions of JS
  // are released. For now, we try to provide some upward compatibility
  // so that future versions of Nav and IE will show they are at
  // *least* JS 1.x capable. Always check for JS version compatibility
  // with > or >=.
  else if (is_nav && (is_major > 5)) is_js = 1.4
  else if (is_ie && (is_major > 5)) is_js = 1.3
  // HACK: no idea for other browsers;
  //       always check for JS version with > or >=
  else is_js = 0.0;
        
  // *** PLATFORM ***
  var is_win   = ( (agt.indexOf("win")!=-1) ||
                   (agt.indexOf("16bit")!=-1) );
  // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4"
  // on all Win32, so you can't distinguish between Win95 and WinNT.
  var is_win95 = ((agt.indexOf("win95")!=-1) ||
                  (agt.indexOf("windows 95")!=-1));
        
  // *** PLATFORM ***
  var is_win   = ( (agt.indexOf("win")!=-1) ||
                   (agt.indexOf("16bit")!=-1) );
  // NOTE: On Opera 3.0, the userAgent string includes "Windows 95/NT4"
  // on all Win32, so you can't distinguish between Win95 and WinNT.
  var is_win95 = ((agt.indexOf("win95")!=-1) ||
                  (agt.indexOf("windows 95")!=-1));
        
  // is this a 16 bit compiled version?
  var is_win16 = ((agt.indexOf("win16")!=-1) ||
             (agt.indexOf("16bit")!=-1) ||
             (agt.indexOf("windows 3.1")!=-1) ||
             (agt.indexOf("windows 16-bit")!=-1) );
        
  // is this a 16 bit compiled version?
  var is_win16 = ((agt.indexOf("win16")!=-1) ||
             (agt.indexOf("16bit")!=-1) ||
             (agt.indexOf("windows 3.1")!=-1) ||
             (agt.indexOf("windows 16-bit")!=-1) );
        
  var is_win31 = ((agt.indexOf("windows 3.1")!=-1) ||
                  (agt.indexOf("win16")!=-1) ||
                  (agt.indexOf("windows 16-bit")!=-1));
        
  var is_win31 = ((agt.indexOf("windows 3.1")!=-1) ||
                  (agt.indexOf("win16")!=-1) ||
                  (agt.indexOf("windows 16-bit")!=-1));
        
  // NOTE: Reliable detection of Win98 may not be possible.
  // It appears that:
  //  - On Nav 4.x and before you'll get plain "Windows" in userAgent.
  //  - On Mercury client, the 32-bit version will return "Win98", but
  //    the 16-bit version running on Win98 will still return "Win95".
  var is_win98 = ((agt.indexOf("win98")!=-1) ||
                  (agt.indexOf("windows 98")!=-1));
  var is_winnt = ((agt.indexOf("winnt")!=-1) ||
                  (agt.indexOf("windows nt")!=-1));
  var is_win32 = (is_win95 || is_winnt || is_win98 ||
                  ((is_major >= 4) &&
                   (navigator.platform == "Win32")) ||
                  (agt.indexOf("win32")!=-1) ||
                  (agt.indexOf("32bit")!=-1));
        
  // NOTE: Reliable detection of Win98 may not be possible.
  // It appears that:
  //  - On Nav 4.x and before you'll get plain "Windows" in userAgent.
  //  - On Mercury client, the 32-bit version will return "Win98", but
  //    the 16-bit version running on Win98 will still return "Win95".
  var is_win98 = ((agt.indexOf("win98")!=-1) ||
                  (agt.indexOf("windows 98")!=-1));
  var is_winnt = ((agt.indexOf("winnt")!=-1) ||
                  (agt.indexOf("windows nt")!=-1));
  var is_win32 = (is_win95 || is_winnt || is_win98 ||
                  ((is_major >= 4) &&
                   (navigator.platform == "Win32")) ||
                  (agt.indexOf("win32")!=-1) ||
                  (agt.indexOf("32bit")!=-1));
        
  var is_os2   = ((agt.indexOf("os/2")!=-1) ||
        
  var is_os2   = ((agt.indexOf("os/2")!=-1) ||
        
                  (navigator.appVersion.indexOf("OS/2")!=-1) ||
                  (agt.indexOf("ibm-webexplorer")!=-1));
        
                  (navigator.appVersion.indexOf("OS/2")!=-1) ||
                  (agt.indexOf("ibm-webexplorer")!=-1));
        
  var is_mac    = (agt.indexOf("mac")!=-1);
  var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) ||
                             (agt.indexOf("68000")!=-1)));
  var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) ||
                              (agt.indexOf("powerpc")!=-1)));
        
  var is_mac    = (agt.indexOf("mac")!=-1);
  var is_mac68k = (is_mac && ((agt.indexOf("68k")!=-1) ||
                             (agt.indexOf("68000")!=-1)));
  var is_macppc = (is_mac && ((agt.indexOf("ppc")!=-1) ||
                              (agt.indexOf("powerpc")!=-1)));
        
  var is_sun   = (agt.indexOf("sunos")!=-1);
  var is_sun4  = (agt.indexOf("sunos 4")!=-1);
  var is_sun5  = (agt.indexOf("sunos 5")!=-1);
  var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
  var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
  var is_irix5 = (agt.indexOf("irix 5") !=-1);
  var is_irix6 = ((agt.indexOf("irix 6") !=-1) ||
                  (agt.indexOf("irix6") !=-1));
  var is_hpux  = (agt.indexOf("hp-ux")!=-1);
  var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
  var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
  var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
  var is_aix1  = (agt.indexOf("aix 1") !=-1);
  var is_aix2  = (agt.indexOf("aix 2") !=-1);
  var is_aix3  = (agt.indexOf("aix 3") !=-1);
  var is_aix4  = (agt.indexOf("aix 4") !=-1);
  var is_linux = (agt.indexOf("inux")!=-1);
  var is_sco   = (agt.indexOf("sco")!=-1) ||
                 (agt.indexOf("unix_sv")!=-1);
  var is_unixware = (agt.indexOf("unix_system_v")!=-1);
  var is_mpras    = (agt.indexOf("ncr")!=-1);
  var is_reliant  = (agt.indexOf("reliantunix")!=-1);
  var is_dec   = ((agt.indexOf("dec")!=-1) ||
         (agt.indexOf("osf1")!=-1) ||
         (agt.indexOf("dec_alpha")!=-1) ||
         (agt.indexOf("alphaserver")!=-1) ||
         (agt.indexOf("ultrix")!=-1) ||
         (agt.indexOf("alphastation")!=-1));
  var is_sinix = (agt.indexOf("sinix")!=-1);
  var is_freebsd = (agt.indexOf("freebsd")!=-1);
  var is_bsd = (agt.indexOf("bsd")!=-1);
  var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun ||
               is_irix || is_hpux ||
               is_sco ||is_unixware || is_mpras || is_reliant ||
               is_dec || is_sinix || is_aix || is_linux ||
               is_bsd || is_freebsd);
        
  var is_sun   = (agt.indexOf("sunos")!=-1);
  var is_sun4  = (agt.indexOf("sunos 4")!=-1);
  var is_sun5  = (agt.indexOf("sunos 5")!=-1);
  var is_suni86= (is_sun && (agt.indexOf("i86")!=-1));
  var is_irix  = (agt.indexOf("irix") !=-1);    // SGI
  var is_irix5 = (agt.indexOf("irix 5") !=-1);
  var is_irix6 = ((agt.indexOf("irix 6") !=-1) ||
                  (agt.indexOf("irix6") !=-1));
  var is_hpux  = (agt.indexOf("hp-ux")!=-1);
  var is_hpux9 = (is_hpux && (agt.indexOf("09.")!=-1));
  var is_hpux10= (is_hpux && (agt.indexOf("10.")!=-1));
  var is_aix   = (agt.indexOf("aix") !=-1);      // IBM
  var is_aix1  = (agt.indexOf("aix 1") !=-1);
  var is_aix2  = (agt.indexOf("aix 2") !=-1);
  var is_aix3  = (agt.indexOf("aix 3") !=-1);
  var is_aix4  = (agt.indexOf("aix 4") !=-1);
  var is_linux = (agt.indexOf("inux")!=-1);
  var is_sco   = (agt.indexOf("sco")!=-1) ||
                 (agt.indexOf("unix_sv")!=-1);
  var is_unixware = (agt.indexOf("unix_system_v")!=-1);
  var is_mpras    = (agt.indexOf("ncr")!=-1);
  var is_reliant  = (agt.indexOf("reliantunix")!=-1);
  var is_dec   = ((agt.indexOf("dec")!=-1) ||
         (agt.indexOf("osf1")!=-1) ||
         (agt.indexOf("dec_alpha")!=-1) ||
         (agt.indexOf("alphaserver")!=-1) ||
         (agt.indexOf("ultrix")!=-1) ||
         (agt.indexOf("alphastation")!=-1));
  var is_sinix = (agt.indexOf("sinix")!=-1);
  var is_freebsd = (agt.indexOf("freebsd")!=-1);
  var is_bsd = (agt.indexOf("bsd")!=-1);
  var is_unix  = ((agt.indexOf("x11")!=-1) || is_sun ||
               is_irix || is_hpux ||
               is_sco ||is_unixware || is_mpras || is_reliant ||
               is_dec || is_sinix || is_aix || is_linux ||
               is_bsd || is_freebsd);
        
  var is_vms   = ((agt.indexOf("vax")!=-1) ||
                  (agt.indexOf("openvms")!=-1));
        
  var is_vms   = ((agt.indexOf("vax")!=-1) ||
                  (agt.indexOf("openvms")!=-1));
        
  </SCRIPT>
        
  </SCRIPT>
        

Authors' Addresses

作者地址

Donald E. Eastlake 3rd Motorola 140 Forest Avenue Hudson, MA 01749 USA

美国马萨诸塞州哈德逊森林大道140号唐纳德E东湖第三摩托罗拉01749

   Phone: +1 978-562-2827(h)
          +1 508-261-5434(w)
   Fax:   +1 508-261-4447(w)
   EMail: Donald.Eastlake@motorola.com
        
   Phone: +1 978-562-2827(h)
          +1 508-261-5434(w)
   Fax:   +1 508-261-4447(w)
   EMail: Donald.Eastlake@motorola.com
        

Chris J. Smith Royal Bank of Canada 277 Front Street West Toronto, Ontario M5V 3A4 CANADA

Chris J.Smith加拿大皇家银行加拿大安大略省西多伦多前大街277号M5V 3A4

   Phone: +1 416-348-6090
   Fax:   +1 416-348-2210
   EMail: chris.smith@royalbank.com
        
   Phone: +1 416-348-6090
   Fax:   +1 416-348-2210
   EMail: chris.smith@royalbank.com
        

David M. Soroka IBM Raleigh, NC

David M.Soroka IBM罗利,北卡罗来纳州

   Phone: +1 919-486-2684
   Fax:   +1 919-543-4653
   EMail: dsoroka@us.ibm.com
        
   Phone: +1 919-486-2684
   Fax:   +1 919-543-4653
   EMail: dsoroka@us.ibm.com
        

Full Copyright Statement

完整版权声明

Copyright (C) The Internet Society (2000). All Rights Reserved.

版权所有(C)互联网协会(2000年)。版权所有。

This document and translations of it may be copied and furnished to others, and derivative works that comment on or otherwise explain it or assist in its implementation may be prepared, copied, published and distributed, in whole or in part, without restriction of any kind, provided that the above copyright notice and this paragraph are included on all such copies and derivative works. However, this document itself may not be modified in any way, such as by removing the copyright notice or references to the Internet Society or other Internet organizations, except as needed for the purpose of developing Internet standards in which case the procedures for copyrights defined in the Internet Standards process must be followed, or as required to translate it into languages other than English.

本文件及其译本可复制并提供给他人,对其进行评论或解释或协助其实施的衍生作品可全部或部分编制、复制、出版和分发,不受任何限制,前提是上述版权声明和本段包含在所有此类副本和衍生作品中。但是,不得以任何方式修改本文件本身,例如删除版权通知或对互联网协会或其他互联网组织的引用,除非出于制定互联网标准的需要,在这种情况下,必须遵循互联网标准过程中定义的版权程序,或根据需要将其翻译成英语以外的其他语言。

The limited permissions granted above are perpetual and will not be revoked by the Internet Society or its successors or assigns.

上述授予的有限许可是永久性的,互联网协会或其继承人或受让人不会撤销。

This document and the information contained herein is provided on an "AS IS" basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTY THAT THE USE OF THE INFORMATION HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

本文件和其中包含的信息是按“原样”提供的,互联网协会和互联网工程任务组否认所有明示或暗示的保证,包括但不限于任何保证,即使用本文中的信息不会侵犯任何权利,或对适销性或特定用途适用性的任何默示保证。

Acknowledgement

确认

Funding for the RFC Editor function is currently provided by the Internet Society.

RFC编辑功能的资金目前由互联网协会提供。