简体   繁体   中英

Java Applet works in Firefox only

I have implemented a Java Applet. I have exported the jar. I signed the jar. And it works if I put it on my server and use it with HTML. But only in Firefox.

Here is the HTML:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE html
  PUBLIC "//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Upload Test</title>
</head>
<body>
    <object archive="applet.jar" classid="java:uploader/FileUpload.class"
    codetype="application/java-vm" width="800" height="600"> </object>

</body>
</html>

I also tried it with this:

<SCRIPT type="text/javascript">
if(browser.value.getIndex("chrome") {
  chrome.browser.enableFeature(JApplet)
});
</SCRIPT>

But still Firefox only. I would really like for this to work in Chrome & IE9. But these two only leave a space where the Applet should be. I can even highlight it.

Are there things I have to add in my xhtml? Or maybe something in the Applet?

I found enough online about why Applets might not work, but nothing about why Firefox only.

As Andrew Thompson said, I need to use deployJava.js. You can find it in this Oracle tutorial. This tutorial describes in detail every step neccessary.

Now my Applet works on all three browsers (FF, Chrome, IE9) like a charm.

Thanks!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM