檢查瀏覽器類型: var navigatorAppName = navigator.appName; if (navigatorAppName == "Netscape")
{
window.location.replace("NSCPTest.html");
}
else if (navigatorAppName == "Microsoft Internet Explorer")
{
window.location.replace("IETest.html");
}
else
{
window.location.replace("MiscTestSwing.html");
}檢查IE版本:
var IEVersion = navigator.appVersion; if (IEVersion >= "4")
{
window.location.replace("IETestPlugin.html");
}
else
{
document.writeln("<h2>Improper Internet Explorer Version</h2><p>" +
"Your Internet Explorer version does not support the APIWizard. Please" +
"access this page with Internet Explorer 5 or higher.\n<p>");
}調用Java Class檢查是否有裝JRE: <OBJECT
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width=1
height=1
>
<PARAM
NAME="java_code"
VALUE="IEPluginFound.class"
>
<PARAM
NAME="java_codebase"
VALUE = "."
>
<PARAM
NAME="archive"
VALUE="APIWizardStartup.jar"
>
<PARAM
NAME="type"
VALUE="application/x-java-applet;version=1.2"
>
IEPluginFound.javaimport java.applet.Applet;
import java.applet.AppletContext;
import java.io.PrintStream;
import java.net.MalformedURLException;
import java.net.URL;public class IEPluginFound extends Applet
{ public void init()
{
} public void start()
{
String s = "IEPlugin.html";
URL url = null;
url = getCodeBase();
try
{
url = new URL(url.toString() + s);
getAppletContext().showDocument(url);
return;
}
catch(MalformedURLException _ex)
{
System.out.println("Unable to create load file URL.");
}
} public IEPluginFound()
{
}
}
{
window.location.replace("NSCPTest.html");
}
else if (navigatorAppName == "Microsoft Internet Explorer")
{
window.location.replace("IETest.html");
}
else
{
window.location.replace("MiscTestSwing.html");
}檢查IE版本:
var IEVersion = navigator.appVersion; if (IEVersion >= "4")
{
window.location.replace("IETestPlugin.html");
}
else
{
document.writeln("<h2>Improper Internet Explorer Version</h2><p>" +
"Your Internet Explorer version does not support the APIWizard. Please" +
"access this page with Internet Explorer 5 or higher.\n<p>");
}調用Java Class檢查是否有裝JRE: <OBJECT
classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
width=1
height=1
>
<PARAM
NAME="java_code"
VALUE="IEPluginFound.class"
>
<PARAM
NAME="java_codebase"
VALUE = "."
>
<PARAM
NAME="archive"
VALUE="APIWizardStartup.jar"
>
<PARAM
NAME="type"
VALUE="application/x-java-applet;version=1.2"
>
IEPluginFound.javaimport java.applet.Applet;
import java.applet.AppletContext;
import java.io.PrintStream;
import java.net.MalformedURLException;
import java.net.URL;public class IEPluginFound extends Applet
{ public void init()
{
} public void start()
{
String s = "IEPlugin.html";
URL url = null;
url = getCodeBase();
try
{
url = new URL(url.toString() + s);
getAppletContext().showDocument(url);
return;
}
catch(MalformedURLException _ex)
{
System.out.println("Unable to create load file URL.");
}
} public IEPluginFound()
{
}
}
解决方案 »
- 关于查看java .jar文件源代码的问题
- 《Thinking in JAVA》中的一段有bug的代码
- 从mysql里取出的事件类型打印出来是Byte[]数组????
- java 串口通信数据读取问题
- java使用jni调用IE的一个问题
- 熟悉socket和tomcat的请进!
- 问一个即时更新JTable中数据的方法
- !!!!!!!!!!!!关于在面板中拖动图片!!!!!!!!!!!!!!!1111
- 我在jb中创建了两个frame....我想通过在第一个frame中的一个按钮,然后打开另一个Frame.....
- 如何将一段applet改成application????
- 在线等,请帮我。。。。
- 高分求解:怎样实现在listener中,当contextDestroyed的时候同时销毁所有的session而不用等它们timeout?
但是我想不需要applet小程序是否也可以判断呢
<applet class="aaa.class" width="167" height="117">
对不起,您的系统没有java虚拟机或者禁用了java Applet支持!
</applet> 判断版本这个还不够,可以考虑使用java script,也可以考虑使用applet运行后获得:)