INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Applet Problems

Problems viewing applets with different browsers, by ackka
Posted: 23 Sep 00 (Edited 29 Apr 05)

This is a faq that i decided to write because of the large number of posts about this problem.

Bascially an Applet is a really small program that operates inside of a single class and is very limited in what it can do.  The Applet is interepreted differentely by whatever Java Runtime Engine you are using.  Each browser uses a different version of Java Runtime Engine.  Microsoft Internet Explorer 4.x,5.x, decided to write their own version of the Java Runtime Environment.  Netscape uses Sun's version and usually is pretty reliable.  So bascially you need to force the browser to use the Sun Microsystems version of the Java Runtime Environment to make sure that your applets look the same in "most" browsers.

Sun knows this and has provided the java plugin to work with whatever version of the JDK you used.  If you are using Swing or anything after JDK1.1 you will have to force the user to download the JDK1.3 Plug-in.  The way to do this is in the html file.  In Internet Explorer plugins have to be modified by a way of registry access to work correctely.  Netscapes just uses the  tags.  So instead of having to write the html file for each applet you create.   Sun provided a application that converts your html automatically.  

To download the Java Plugin Version 1.3 here is the link

http://java.sun.com/products/plugin/index.html

To download the Java Html converter here is the link
http://java.sun.com/products/plugin/1.3/features.html

Notice:  These links will change, as what happened with the last FAQ I wrote so go to Java.sun.com and do a search for Java Plugin

------------------------------------------------------------------------------------
This is the code to link to an Applet using the AppletViewer or in Netscape

CODE

<html>
<body>

<applet code =&quot;Whatever.class&quot; archive=&quot;Whatever.jar&quot; width=200 height=200>
</applet>

</body>
</html>

Unfortunately Micro$oft decided that it would not play nice.  So if you use the previous code to call your applet certain things will not work.  The reason for this is that you are not using the  Sun plugin, you are using Micro$oft's version.  To force the Sun plugin to activate you need to use the following code

CODE

<html>
<body>

<!--&amp;quot;CONVERTED_APPLET&amp;quot;-->
<!-- CONVERTER VERSION 1.3 -->
<OBJECT classid=&quot;clsid:8AD9C840-044E-11D1-B3E9-00805F499D93&quot;
WIDTH = 200 HEIGHT = 200  codebase=&quot;http://java.sun.com/products/plugin/1.3/jinstall-13-win32.cab#Version=1,3,0,0&quot;>
<PARAM NAME = CODE VALUE = &quot;Whatever.class&quot; >
<PARAM NAME = ARCHIVE VALUE = &quot;Whatever.jar&quot; >

<PARAM NAME=&quot;type&quot; VALUE=&quot;application/x-java-applet;version=1.3&quot;>
<PARAM NAME=&quot;scriptable&quot; VALUE=&quot;false&quot;>
<COMMENT>
<EMBED type=&quot;application/x-java-applet;version=1.3&quot;  CODE = &quot;Whatever.class&quot; ARCHIVE = &quot;Whatever.jar&quot; WIDTH = 200 HEIGHT = 200  scriptable=false pluginspage=&quot;http://java.sun.com/products/plugin/1.3/plugin-install.html&quot;><NOEMBED></COMMENT>

</NOEMBED></EMBED>
</OBJECT>

<!--
<APPLET CODE = &amp;quot;Whatever.class&amp;quot; ARCHIVE = &amp;quot;Whatever.jar&amp;quot; WIDTH = 200 HEIGHT = 200>


</APPLET>
-->
<!--&amp;quot;END_CONVERTED_APPLET&amp;quot;-->


</body>
</html>
------------------------------------------------------------------------------------
This code is designed to work for Netscape and IE, and will both auto download the Java Plugin and also link to Applet to the plugin....This code will not work in the AppletViewer in the JDK

If you don't feel like typing this in all the time Sun very nicely created an application that converts this html automatically, also allows you to enter parameters etc... it can be found at
http://java.sun.com/products/plugin/1.3/features.html


good luck

tom

thomas.moses@gmail.com

Back to Java FAQ Index
Back to Java Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close