如何在JSP上放置相容Firefox、IE、Chrome的applet

來源:互聯網
上載者:User

 pplet雖然已經基本上沒人用了。但是它還有一些應用情境的,為了相容性。為了各個瀏覽器,不能直接直接寫<applet>標籤,最後考慮一下測試了幾天,最後還是寫如下比較適合多個瀏覽器安全色,希望對大家有所協助

<%@page language="java" import="java.util.*" pageEncoding="UTF-8"contentType="text/html; charset=utf-8"%><%//該寫法相容Firefox、IE、Chrome瀏覽器//applet載入類String appletClass = "cn.com.pansky.frame.cqap.printer.CQAPPrinterApplet.class";//依賴jar包目錄String appletCodebase="applets";String appletJar = "commons-logging-1.1.1.jar,commons-collections-2.1.1.jar,jfreechart-1.0.12.jar,jcommon-1.0.15.jar";int width = 300, height = 200;//查詢參數String queryString = request.getQueryString();if (queryString == null) {queryString = "";}queryString = "/otp/cqap/cqap-printer.servlet.jsp?" + queryString;%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="X-UA-Compatible" content="IE=EmulateIE8" /><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>列印</title></head><body><!-- 環境判斷 --><!--"CONVERTED_APPLET"--><!-- CONVERTER VERSION 1.1 --><SCRIPT LANGUAGE="JavaScript"><!--    var _info = navigator.userAgent; var _ns = false;    var _ie = (_info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0 && _info.indexOf("Windows 3.1") < 0);//--></SCRIPT><COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--    var _ns = (navigator.appName.indexOf("Netscape") >= 0 && ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0 && java.lang.System.getProperty("os.version").indexOf("3.5") < 0) || (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));//--></SCRIPT></COMMENT><!-- applet展示 --><%--<applet width=460 height=160>    <PARAM NAME=CODE     VALUE="<%=appletClass%>"><PARAM NAME=CODEBASE VALUE="applets"><PARAM NAME=ARCHIVE  VALUE="<%=appletJar%>">    <PARAM NAME="type"   VALUE="application/x-java-applet;version=1.2.2">    <PARAM NAME="scriptable" VALUE="false">    <PARAM NAME="REPORT_URL" VALUE ="<%=queryString%>"></applet>--%><OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"type="application/x-java-bean;version=1.1.2"codebase="http://java.sun.com/products/plugin/1.1.2/jinstall-112-win32.cab#Version=1,1,2,0"WIDTH="<%=width%>" HEIGHT="<%=height%>"><PARAM NAME=CODEBASE VALUE="<%=appletCodebase %>"><PARAM NAME=ARCHIVE VALUE="<%=appletJar%>"><PARAM NAME=CODE VALUE="<%=appletClass%>"><PARAM NAME="scriptable" VALUE="false"><PARAM NAME="REPORT_URL" VALUE="<%=queryString%>"><comment><EMBED type="application/x-java-bean;version=1.1.2"pluginspage="http://java.sun.com/products/plugin/1.1.2/plugin-install.html"CODE="<%=appletClass%>" CODEBASE="<%=appletCodebase %>"ARCHIVE="<%=appletJar %>"WIDTH="<%=width%>" HEIGHT="<%=height%>"REPORT_URL="<%=queryString%>" scriptable=false><noembed></noembed></EMBED></comment></OBJECT></body></html>
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.