views:

400

answers:

3

looking for a javascript class like swfobject to embed java and have a simple fallback if the user doesn't have java or refuses the security prompt.

thanks,

Josh

+2  A: 

appletobject may work, but I have not used it.

Jared314
+5  A: 

You could build one pretty easily.

Have something like a div set up like this:

<div id="java-applet">
Message to user saying that they need Java here
</div>

Then add Java Plugin Detection (builder) to your JavaScript. Then if that returns true, then do something like:

document.getElementById("java-applet").innerHTML = "<applet>stuff here</applet>";
kennyisaheadbanger
+2  A: 

Just embed the applet like you normally do and insert the fallback inside or insert a javascript snippet to remove the object: Besides param, you can add other elements, e.g. paragraphs with text or javascript calling some function to replace the object.

<script type="text/javascript">
  function replace_object(x) {
    $(x)...
  }
</script>
<object x="y" id="some_applet">
  <param name="y" value="z">
  <p>java not available. some alternative here. <!-- option 1 --></p>
  <script type="text/javascript">
    replace_object('some_applet'); // option 2
  </script>
</object>
bb