1 2 Previous Next 16 Replies Latest reply: Aug 28, 2010 11:28 PM by 843807 RSS

    <applet> tag vs. <object> tag

    EJP
      What's the current thinking on this? There was a huge effort a few years ago to get us all to use the object tag, with all its additional browser dependencies ... Seems to me that's all crazy, that all browsers will have to support the applet tag forever, and we should all just keep our lives simple. Is there anything against this? I'm investigating some problems with a pretty standard applet that just doesn't launch in some browsers, e.g. Chrome, ...
        • 1. Re: <applet> tag vs. <object> tag
          EJP
          To answer my own question, we did some experiments.

          |*Tag*|*Browser*|*result*|
          |applet|IE7|OK|
          |applet|IE8|OK|
          |applet|FireFox|OK|
          |applet|Safari|Nothing|
          |applet|Chrome|Nothing|
          |object|IE7|Empty box|
          |object|IE8|Empty box|
          |object|FireFox|OK|
          |object|Safari|OK|
          |object|Chrome|OK|

          Tested on Windows XP, Vista, and MacOS where possible.

          So the <object> tag works in all browsers except IE, and in fact IE does support a different (needless to say) form of it requiring two tags.

          I suspect the above is a bit skewed by the fact that we are using strict XHTML, for other reasons (i.e. to tame IE again in other ways), and <applet> isn't part of XHTML Strict. I would guess that otherwise the <applet> tag would have worked in all browsers.
          • 2. Re: <applet> tag vs. <object> tag
            843807
            All the applets I have ever done have been used by windows users and I've only ever used the applet tag but...

            isn't JNLP supposed to solve all this?

            [http://download-llnw.oracle.com/javase/tutorial/deployment/applet/deployingApplet.html]

            I mean it's JavaScript with a bunch of magical detection.
            • 3. Re: <applet> tag vs. <object> tag
              793415
              ejp wrote:
              What's the current thinking on this?
              It's all about minimum version, really. Do you have a target audience for the applets, with a set minimum JRE to work to? Or alternately are your applets provided on the World Wild Web for all comers?

              If the former, I'd go with the applet element & HTML 4.01 Transitional for the web page.
              -------------------

              If the latter, ..
              ..There was a huge effort a few years ago to get us all to use the object tag, ..
              ..Sun's HTML Converter & later the deployJava.js were devised to create nested object/embed tags. I had not seen any pages that ever recommended just the object element. I've not known the <object> element to be workable on all browsers, but the last time I tested was a while ago. Your test results suggest it is about the same now.

              AFAIU Sun's deployJava.writes either object or embed elements in a general form similar to what the HTML Converter tool used to write as a single nested element. The JS approach is superior in that:
              - Pages will validate.
              - Browser determination, downloading a JRE if necessary & writing the tag is 'all done for you' (after configuring the attributes & parameters).
              - Sun supports it and updates it - encouraging developers to hot-link to their script.
              Disadvantages:
              - Subject to breakage by Sun (who arguably produce the worst JS that this novice in JS has ever seen).
              - Requires Sun server up.
              - Requires internet connection.
              - Requires JS enabled. (1)

              The middle 2 can be fixed by hosting a copy of the script at a location the user's browser can access - but you do not get 'free' updates of course.

              ---------------------
              There is also the JWS embedded applet, as already mentioned.

              GifAnim is an example of that. It uses the JNLP services to access the file system even when sand-boxed - with the user's specific permission at the moment it attempts to do so.
              • 4. Re: <applet> tag vs. <object> tag
                EJP
                It's an Internet deployment to unknown customers so coverage is all. Network engineers, so I think I can safely stipulate Java 1.5 and the top four browsers whatever they are, my guess is IE, Firefox, Safari, and Chrome.

                I'd love to go for the JNLP solution but I just tried it - OK in FF/XP but big blank nothing on Safari/MacOS, which isn't encouraging. Still I will repeat the experiment using JNLP everywhere and update.

                Another thing the investigation turned up is that AT&T is still using IE6 and nothing later.
                • 5. Re: <applet> tag vs. <object> tag
                  793415
                  ejp wrote:
                  ..I'd love to go for the JNLP solution but I just tried it - ..
                  It would seem the JNLP embedded applet is ruled out by the requirement for 1.5. Why not deploy the applet free-floating?
                  • 6. Re: <applet> tag vs. <object> tag
                    843807
                    ejp wrote:
                    It's an Internet deployment to unknown customers so coverage is all. Network engineers, so I think I can safely stipulate Java 1.5 and the top four browsers whatever they are, my guess is IE, Firefox, Safari, and Chrome.

                    I'd love to go for the JNLP solution but I just tried it - OK in FF/XP but big blank nothing on Safari/MacOS, which isn't encouraging. Still I will repeat the experiment using JNLP everywhere and update.

                    Another thing the investigation turned up is that AT&T is still using IE6 and nothing later.
                    One of the customers I support at my main job, who is one of the largest hospitals here, is using IE5.

                    Well then maybe the solution is a detection script. I normally use jquery and let it sort out the browser mess but in this specific case I have heard of issues with FF with jquery and applets on the same page.
                    • 7. Re: <applet> tag vs. <object> tag
                      EJP
                      @Andrew, does that only work with 1.6?

                      @Max, the applet is inside a Facelets page so detection of the browser isn't a problem ... I just want to find the minimal answer. I have it now rendering the applet tag for IE and the object tag for everything else, and I'm using Sun's script from the link you posted to enforce at least Java 1.5, and I suspect that's how it will stay unless I can get a JNLP solution working. I suppose I could enforce 1.6 and then use JNLP if that's what the current problem is ... Depending on user feedback too ...
                      • 8. Re: <applet> tag vs. <object> tag
                        793415
                        ejp wrote:
                        @Andrew, does that only work with 1.6?
                        JWS was available (for either applets or frames) as a separate download since 1.2. It was co-bundled with the JRE in 1.4 or 1.4.2 (hazy on the details). It should support 1.5+ machines with no problems.
                        • 9. Re: <applet> tag vs. <object> tag
                          EJP
                          That's what I thought, and I thought that's what I read at the link Max provided as well. I was wondering why you said the JNLP embedded applet was ruled out by the requirement for 1.5. Also what exactly you meant by 'free-floating'?
                          • 10. Re: <applet> tag vs. <object> tag
                            793415
                            ejp wrote:
                            That's what I thought, and I thought that's what I read at the link Max provided as well. I was wondering why you said the JNLP embedded applet was ruled out by the requirement for 1.5. Also what exactly you meant by 'free-floating'?
                            An applet is normally 'embedded' in a web page while a frame is normally 'free-floating'.
                            - JWS could launch applets free-floating like a frame since 1.2.
                            - Since 1.6.0_10, JWS and JNLP services are also available to embedded applets.
                            • 11. Re: <applet> tag vs. <object> tag
                              EJP
                              Ah OK thanks. That might also explain why the JNLP embedded applet launch failed on Safari/MacOS as I described above: I'm not sure where the Java on that box is up to.
                              • 12. Re: <applet> tag vs. <object> tag
                                EJP
                                Updated results, now including Opera and JNLP:

                                |*Tag*|*Browser*|*Result*|
                                |applet|IE7|OK|
                                |"|IE8|OK|
                                |"|FireFox|OK|
                                |"|Safari|Nothing|
                                |"|Chrome|Nothing|
                                |"|Opera|OK|
                                |object|IE7|Empty box|
                                |"|IE8|Empty box|
                                |"|FireFox|OK|
                                |"|Safari|OK|
                                |"|Chrome|OK|
                                |"|Opera|OK|
                                |JNLP|IE7|Unknown (not available over the weekend)|
                                |"|IE8|OK|
                                |"|FireFox|OK|
                                |"|Safari|Nothing|
                                |"|Chrome|Nothing|
                                |"|Opera|OK|

                                This is now with DOCTYPE = XHTML Transitional.

                                The fact that JNLP didn't work on two out of the five platforms is pretty alarming.

                                My conclusion is that the simplest solution is to use <object> everywhere and just detect MSIE as a special case (as usual ;-)), for which you should use either <applet> or the special double-<object> form, if you can be bothered. I cant.
                                • 13. Re: <applet> tag vs. <object> tag
                                  843807
                                  It's really about <object> vs <embed> as <applet> is deprecated in HTML5.

                                  I did quite a lot of work on this and created a page detailing [JNLP applets in XHTML|http://l0x.in/XML/XHTML/basic-applet.xhtml]

                                  The method used on that page works on

                                  Firefox
                                  Chrome
                                  Opera
                                  IE9

                                  But sadly not Safari, which I believe is a bug with Safari.

                                  The page can't be viewed with IE7 or IE8 as it's XHTML and I've not tried JNLP's on either of those browsers.
                                  • 14. Re: <applet> tag vs. <object> tag
                                    EJP
                                    Thanks. The method I used, described above, works on them all.
                                    1 2 Previous Next