问题
I'm having the following problem running a Java applet in Chrome.
This is the script I have in my page:
<script type="text/javascript" src="http://www.java.com/js/deployJava.js"></script>
<script type="text/javascript">
var attributes = { code: 'com.mycompany.MyApplet',
id: 'myApplet', name: 'myApplet', width: 710, height: 540 };
var parameters = { jnlp_href: "MyApplet.jnlp" } ;
var version = '1.6';
deployJava.runApplet(attributes, parameters, version);
</script>
<noscript>This page requires JavaScript.</noscript>
And this is my .jnlp:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp href="MyApplet.jnlp">
<information>
<title>My Applet</title>
<vendor>My Company</vendor>
<offline-allowed />
</information>
<resources>
<j2se version="1.6+" />
<jar href="MyApplet.jar" />
</resources>
<applet-desc
name="My Applet"
main-class="com.mycompany.MyApplet"
width="710"
height="540">
</applet-desc>
</jnlp>
I have JREs 1.4 and 1.6 update 29 installed in my machine. In IE and Firefox the applet runs correctly, but in Chrome I'm being prompt to download JRE 7.
If install JRE 7 the applet runs correctly. But I cannot force end users to do that because this web application will be used by people with no administrative rights on their computers.
I read over here that this is because a bug in deployJava.js with Chrome, and the solution stated is to remove alder JREs. Unfortunately, that's not possible either because end users need JRE 4 to run other old Java desktop applications they use everyday.
Can I tweak the javascript or jnlp posted somehow to make this work in Chrome using JRE 1.6?
来源:https://stackoverflow.com/questions/8011154/java-applet-chrome-prompts-to-download-java-7-ie-and-firefox-dont