Firefox not calling an applet method

Discussion in 'Javascript' started by Blondie21, Sep 26, 2005.

  1. Blondie21

    Blondie21 Guest

    Hi,
    I have a .jsp file in the following format:

    .... html headers, jsp code, html code...

    <jsp:plugin
    type="applet"
    code="path.in.packet.appletclassname.class"
    codebase=".."
    jreversion="1.5"
    archive="packetname.jar"
    height="0"
    width="0"
    name="appletname"
    >

    <jsp:fallback>
    <p>Unable to start the applet.</p>
    </jsp:fallback>
    </jsp:plugin>

    .... html code...

    <script type="text/javascript">
    var theApplet = document.applets.appletname;
    methodOutput = theApplet.callmethod();
    document.write(methodOutput);
    </script>

    .... the rest of the html code ...

    Javascript can call this method with IE 6.0, but with Firefox I get the
    following message: "Error: theApplet has no properties".

    And here is how Firefox and IE6.0 translate my <jsp:plugin> tag:

    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    name="appletname"
    width="0" height="0"
    codebase="http://java.sun.com/products/plugin/1.2.2/jinstall-1_2_2-win.cab#Version=1,2,2,0">;
    <PARAM name="java_code" value="path.in.packet.appletclassname.class">
    <PARAM name="java_codebase" value="..">
    <PARAM name="java_archive" value="packetname.jar">
    <PARAM name="type" value="application/x-java-applet;version=1.5">

    <COMMENT>
    <EMBED type="application/x-java-applet;version=1.5" name="appletname"
    width="0"
    height="0" pluginspage="http://java.sun.com/products/plugin/";
    java_code="path.in.packet.appletclassname.class"
    java_codebase=".."
    java_archive="packetname.jar"
    clientLocale="en_IE">
    <NOEMBED>
    </COMMENT>

    <p>Unable to start the applet.</p>

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

    I have already tried other solutions, like
    document.getElementsByName() and
    document.embeds ( as well as document.getElementsByID, but this could
    never work with Firefox as, from what I found in google, Firefox does
    not assume that applet name = applet id, what IE does).
    Still, I never managed to call this method with Firefox.
    Would anyone have any other ideas?

    Thank you,

    Blondie
     
    Blondie21, Sep 26, 2005
    #1
    1. Advertising

  2. Blondie21 wrote:


    > <script type="text/javascript">
    > var theApplet = document.applets.appletname;
    > methodOutput = theApplet.callmethod();
    > document.write(methodOutput);


    To access an object like an applet in the DOM and be able to call its
    methods the object needs to be loaded and intialized so your chance to
    script an applet by putting the above code simply somewhere in the body
    of the HTML document are very low as it is executed while the document
    is loaded.
    Put the applet in the HTML document and then use script in the onload
    handler to try to script the applet. Of course that script can't do
    document.write then but I guess that attempt above is only some poor
    attempt at debugging.
    Or place a button in the HTML document which in its onclick handler
    tries to script the applet.


    > And here is how Firefox and IE6.0 translate my <jsp:plugin> tag:
    >
    > <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"


    The browser does not translate any <jsp> tags at all, your server side
    framework does that and then delivers HTML or HTML tag soup to the browser.


    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
     
    Martin Honnen, Sep 26, 2005
    #2
    1. Advertising

  3. Blondie21

    Blondie21 Guest

    Martin Honnen wrote:
    >
    > To access an object like an applet in the DOM and be able to call its
    > methods the object needs to be loaded and intialized so your chance to
    > script an applet by putting the above code simply somewhere in the body
    > of the HTML document are very low as it is executed while the document
    > is loaded.
    > Put the applet in the HTML document and then use script in the onload
    > handler to try to script the applet. Of course that script can't do
    > document.write then but I guess that attempt above is only some poor
    > attempt at debugging.
    > Or place a button in the HTML document which in its onclick handler
    > tries to script the applet.
    >


    Thank you for your answer.
    No, I'm not using this for debugging.
    I still don't understand why this works fine with IE. And what does DOM
    have to do with it at all?

    Thank you,
    Blondie21
     
    Blondie21, Sep 27, 2005
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jabel D. Morales - VMan of Mana

    Problems with JNI: calling a Java method from native method.

    Jabel D. Morales - VMan of Mana, Aug 1, 2003, in forum: Java
    Replies:
    1
    Views:
    4,805
    Joseph Millar
    Aug 1, 2003
  2. Archana
    Replies:
    1
    Views:
    1,390
    Andrew Thompson
    Oct 25, 2004
  3. crazytazo
    Replies:
    3
    Views:
    1,261
    Daniel Pitts
    Oct 7, 2008
  4. SPG
    Replies:
    0
    Views:
    73
  5. why-em-jay

    Calling a method of the calling object ...

    why-em-jay, Sep 15, 2005, in forum: Perl Misc
    Replies:
    3
    Views:
    179
    Anno Siegel
    Sep 15, 2005
Loading...

Share This Page