• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

How to call applet methods from JavaScript, when using Java Plug-in in Netscape 4.78?

 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all!
I need to use Java Plug-in, because I use the Swing-package.
When I let my browser, Netscape 4.78, use the Java Plug-in in j2re1.4.1,then JavaScript believe that the applet vector is empty.
I have tested to let JavaScript call methods of an applet that only extends Applet. It worked fine (and the appletvector has length 1), when the Java Plug-in wasn't used.
How can I make JavaScript call (swing)applet methods, when my browser is using the Plug-in?
Thanks in advance for your help!
Carina
 
Ranch Hand
Posts: 1179
Mac OS X Eclipse IDE
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try read Chapter 24 and 25 from this link:
http://java.sun.com/j2se/1.4/docs/guide/plugin/developer_guide/contents.html
/Rene
 
Carina Svensson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It seems like it's impossible to scripting applets in Netscape 4.78, when the browser is using Java Plug-in.
I believe that I'm forced to install Netscape 6 or IE to manage.
Carina
 
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. Applets loaded by the plug-in simply don't appear in the Document Object Model, so you can neither check if the applet has been loaded nor call methods on the applet.
What you can do, though, is examine the javsScript object model from the applet. In the past I have "faked" this by running a thread in the applet which polls some JavaScript object (say window.applet_input), checking if it has changed every second or so. If it has changed, call some method. It's not real applet method calling, and you have to be careful with how much CPU time you use up, but it does work, even in NS4!
 
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
wow!
finally. i posted the same problem in three different forum. didn't get a SINGLE response.
i derived that one can't use applet methods calls in the javascript if we use applet plugin. this is because EMBED tag has a name method but as indicated by one of the previous post, javascript doesn't recognize EMBEDED applet in the applet array. when we try document.applets.length it gives 0 (in case we have one plugin embedded applet).
of course this is only with NN as IE uses OBJECT tag and with ID attribute we are able to call applet methods.
hey, frank,
to be very frank i didn't understand what u suggested. not at all. how do we do that? can u please tell me what u did exactly (may be u can post a sample code as i'm bad at grasping w/o examples).
thanks a lot
maulin.
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry guys. i thought nobody replied as i didnt get reply for days.
here is the link of my post on HTML/JavaScript forum...
here
regards
maulin
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmm. I can't post the exact code I used on the most recent occasion I did this, as I don't own the rights to it, and I'm afraid I don't have the time right now to write one from scratch.
However, I'm sure you can come up with something similar if you start by looking up how to read/write JavaScript values from an applet. This should be documented wherever you found out about accessing applets from JavaScript.
Just try it out with a simple applet which displays the value of a JavaScript item, then write some JavaScript which changes the value (say by clicking a button or reading a field), and work out how to get your applet to look at the value to see if it has changed.
Good luck.
 
Frank Carver
Sheriff
Posts: 6920
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As this one seems more active, I've closed the thread in HTML/JavaScript and requested people follow up over here.
 
Carina Svensson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Frank for your answer, now I know the conditions for sure.
I think I can't use your thread suggestion, because the applet methods will be called when the user is clickning on an URL link, i.e. the methods will be called in the onload-event
The objects returned from the applet methods, will be used in the creation of the new page.
I still believe that I have to use Netscape 6 instead.
Carina
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic