00000001.htm
来自「水木清华BBS」· HTM 代码 · 共 677 行 · 第 1/5 页
HTM
677 行
recommended unless your HTML page is browsed by users in a <BR>homogeneous environment. The Java Plug-in HTML Converter from <BR>Sun Microsystems automatically converts HTML pages into this <BR>tag style for you. <BR>Java Plug-in Anywhere <BR>In an Internet/intranet environment, an HTML page is likely to <BR>be seen by browsers on different platforms. You should activate <BR>Java Plug-in only on the right browser and platform combination. <BR>Otherwise, you should use the browser's default JVM. You can <BR>achieve this using the following Java Plug-in tag: <BR>Original APPLET tag: <BR><APPLET code="XYZApp.class" codebase="html/" align="baseline" <BR> width="200" height="200"> <BR><PARAM NAME="model" VALUE="models/HyaluronicAcid.xyz"> <BR> No JDK 1.2 support for APPLET!! <BR></APPLET> <BR>New style tag: <BR>The following is an example of an equivalent Java Plug-in tag. <BR>This example includes comments. <BR><!-- The following code is specified at the beginning of the <BODY> tag. --> <BR><SCRIPT LANGUAGE="JavaScript"><!-- <BR> var _info = navigator.userAgent; var _ns = false; <BR> var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 <BR> && _info.indexOf("Windows 3.1") < 0); <BR>//--></SCRIPT> <BR><COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!-- <BR> var _ns = (navigator.appName.indexOf("Netscape") >= 0 <BR> && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 <BR> && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) <BR> || _info.indexOf("Sun") > 0)); <BR>//--></SCRIPT></COMMENT> <BR><!-- The following code is repeated for each APPLET tag --> <BR><SCRIPT LANGUAGE="JavaScript"><!-- <BR> if (_ie == true) document.writeln(' <BR><OBJECT <BR> classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" <BR> width="200" height="200" align="baseline" <BR>codebase="<A HREF="http://java.sun.com/products/plugin/1.2/">http://java.sun.com/products/plugin/1.2/</A> <BR>jinstall-12-win32.cab#Version=1,2,0,0"> <BR> <NOEMBED><XMP>'); <BR> else if (_ns == true) document.writeln(' <BR><EMBED <BR> type="application/x-java-applet;version=1.2" width="200" height="200" <BR> align="baseline" code="XYZApp.class" codebase="html/" <BR> model="models/HyaluronicAcid.xyz" <BR> pluginspage="<A HREF="http://java.sun.com/products/plugin/1.2/plugin-install.html">">http://java.sun.com/products/plugin/1.2/plugin-install.html"></A> <BR> <NOEMBED><XMP>'); <BR>//--></SCRIPT> <BR> <APPLET code="XYZApp.class" codebase="html/" align="baseline" <BR> width="200" height="200"> <BR></XMP> <BR> <PARAM NAME="java_code" VALUE="XYZApp.class"> <BR> <PARAM NAME="java_codebase" VALUE="html/"> <BR> <PARAM NAME="java_type" VALUE="application/x-java-applet;version=1.2"> <BR> <PARAM NAME="model" VALUE="models/HyaluronicAcid.xyz"> <BR> No JDK 1.2 support for APPLET!! <BR></APPLET></NOEMBED></EMBED> <BR></OBJECT> <BR><!-- <BR> <APPLET code="XYZApp.class" codebase="html/" align="baseline" <BR> width="200" height="200"> <BR> <PARAM NAME="model" VALUE="models/HyaluronicAcid.xyz"> <BR> No JDK 1.2 support for APPLET!! <BR> </APPLET> <BR>--> <BR> <BR> Although this tag seems complicated compared to the old APPLET <BR>tag, it is not. Most of the Java Plug-in tag is the same regardless <BR>of the applet used. For the majority of cases, a webmaster can copy <BR>and paste the Java Plug-in tag. <BR>The first block of the script extracts the browser and platform. You <BR>must determine the browser and platform on which the applet is running. <BR>You do this by using JavaScriptTM to extract first the browser name, <BR>then the platform. This is done once per HTML document. <BR>The second block of the script replaces the APPLET tag. You must <BR>replace each APPLET tag with a similar block of code. The script <BR>replaces the APPLET tag with either an EMBED tag or OBJECT tag, <BR>depending on the browser. You use the OBJECT tag for IE and the <BR>EMBED tag for Netscape Navigator. Finally, the original APPLET tag <BR>is included as a comment at the end. It is always a good idea to <BR>keep the original APPLET tag in case you want to remove the Java <BR>Plug-in invocation. <BR>The first JavaScript establishes the browser and the platform on <BR>which the browser is running. You must do this because, currently, <BR>Java Plug-in supports only Windows 95, Windows 98, Windows NT 4.0, <BR>and Solaris. Note that Windows NT 3.51 is the only Win32 platform <BR>that Java Plug-in does not support. Java Plug-in should be invoked <BR>only on the supported browser and platform. The script sets the <BR>variable _ie to true if the browser is Internet Explorer. It sets <BR>the variable _ns to true if the browser is Navigator. (Note that <BR>all variable names in the JavaScript start with "_". This is done <BR>to avoid conflicting with other JavaScript variables in the same <BR>page.) <BR>To detect the right browser, the JavaScript evaluates three strings <BR>that are within the JavaScript's Navigator object: userAgent, <BR>appVersion, and appName. These strings contain information about <BR>the browser and the platform. By looking at some examples of the <BR>string userAgent, you can see how to evaluate userAgent and use it <BR>to determine the browser. The following are some examples of the <BR>userAgent string for different platforms as it appears in Internet <BR>Explorer. <BR>Platform and Browser JavaScript's Navigator.userAgent string <BR>Windows NT 4.0 w/IE 4.0 "Mozilla/4.0 (compatible; MSIE 4.0; Windows NT)" <BR>Windows NT 4.0 w/IE 3.02 "Mozilla/2.0 (compatible; MSIE 3.02; Windows NT)" <BR>Windows 95 w/IE 4.0 "Mozilla/4.0 (compatible; MSIE 4.0; Windows 95)" <BR>Windows 95 w/IE 3.02 "Mozilla/2.0 (compatible; MSIE 3.02; Windows 95)" <BR>Windows NT 3.51 w/IE 4.0 "Mozilla/4.0 (compatible; MSIE 4.0; Windows 3.1)" <BR>Windows 3.1 w/IE 4.0 "Mozilla/4.0 (compatible; MSIE 4.0; Windows 3.1)" <BR>Windows NT 4.0 w/Navigator 4.04 "Mozilla/4.04 [en] (WinNT; I)" <BR>Windows NT 4.0 w/Navigator 3.04 "Mozilla/3.04 (WinNT; I)" <BR>Windows NT 3.51 w/Navigator 4.04 "Mozilla/4.04 [en] (WinNT; I)" <BR>Windows NT 3.51 w/Navigator 3.04 "Mozilla/3.04 (WinNT; I)" <BR>Windows 95 w/Navigator 4.03 "Mozilla/4.03 [en] (Win95; I)" <BR>Windows 95 w/Navigator 3.03 "Mozilla/3.03 (Win95; I)" <BR>Solaris 2.6 w/Navigator 4.02 "Mozilla/4.02 [en] (X11; l; SunOS 5.6 sun4u) <BR>/* 此处删去了一个表格。 */ <BR> The above table shows that only Windows 95 and Windows NT 4.0 with IE <BR>can pass the Java Plug-in browser and platform requirements. However, <BR>this logic makes no assumptions about future releases of IE or future <BR>releases of Windows with IE. As long as the userAgent string contains <BR>"MSIE" and "Win", the above code should work in future releases of <BR>IE on Win32. <BR>The above logic summarizes into the following: <BR> <BR><SCRIPT LANGUAGE="JavaScript"><!-- <BR> var _info = navigator.userAgent; <BR> var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 <BR> && _info.indexOf("Windows 3.1") < 0); <BR>//--></SCRIPT> <BR> <BR> It is harder to detect Navigator on the right platform. Using just <BR>JavaScript, there is no way to determine if the browser is running <BR>on the Windows NT 3.51 or Windows NT 4.0 operating platform. (Refer
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?