Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Re: Browser plug-in to interact with browser

Reply
Thread Tools

Re: Browser plug-in to interact with browser

 
 
DKM
Guest
Posts: n/a
 
      05-26-2005


Andrew Thompson wrote:
> On 25 May 2005 13:10:22 -0700, DKM wrote:
>
> > Hello, I am trying to find out if it is possible to create browser
> > plug-in using java. The plug-in should have access to the browser's DOM
> > and shoud be able to dynamically alter content and style of any element
> > by responding to mouse movement and clicks anywhere on the browser
> > document.
> >
> > I am new to all this, but I am familiar with javescript and html. And,
> > currently, I can achieve what I want using just javascript. But, I
> > would like to encapsulate all the javascript code in a java plug-in.

>
> LiveConnect allows Java and JS to interact. The most common way
> to achieve what you want is to have the Applet communicate via
> LiveConnect to the JS that directly interacts with/changes the DOM.
>
> HTH


Thank you for the above info. Will this work in Netscape, Internet
Explorer and Mozilla browsers?

Thank you again in advance.

D.K. Mishra

>
> --
> Andrew Thompson
> http://www.PhySci.org/codes/ Web & IT Help
> http://www.PhySci.org/ Open-source software suite
> http://www.1point1C.org/ Science & Technology
> http://www.LensEscapes.com/ Images that escape the mundane


 
Reply With Quote
 
 
 
 
Andrew Thompson
Guest
Posts: n/a
 
      05-26-2005
On 26 May 2005 05:24:37 -0700, DKM wrote:

JS <-> Applet (connected via LiveConnect) to manipulate DOM.

> Will this work in Netscape, Internet
> Explorer and Mozilla browsers?


I do not know. Try it and report back.

[ That also depends upon whether you can even get the JS to
work across the chosen browsers - no easy feat. ]

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
 
 
 
DKM
Guest
Posts: n/a
 
      05-26-2005


Andrew Thompson wrote:
> On 26 May 2005 05:24:37 -0700, DKM wrote:
>
> JS <-> Applet (connected via LiveConnect) to manipulate DOM.
>
> > Will this work in Netscape, Internet
> > Explorer and Mozilla browsers?

>
> I do not know. Try it and report back.
>
> [ That also depends upon whether you can even get the JS to
> work across the chosen browsers - no easy feat. ]


I have it working in IE and Firefox using only javascript. But, I know
what you mean, I had to dig into the dom of both the browsers to
understand what is implemented and what is not and determine the common
denominator.

As for reporting back on utilizing Liveconnect, that may take a while.
I have to learn an enormous amount before I start coding for the
browser plug-in.

Do you know of any simple example of a browser plug-in written in Java
that does a simple thing like changing the color or text of any
element.

Thank you very much in advance.

D.K. Mishra



>
> --
> Andrew Thompson
> http://www.PhySci.org/codes/ Web & IT Help
> http://www.PhySci.org/ Open-source software suite
> http://www.1point1C.org/ Science & Technology
> http://www.LensEscapes.com/ Images that escape the mundane


 
Reply With Quote
 
Roland
Guest
Posts: n/a
 
      05-26-2005
On 26-5-2005 16:01, DKM wrote:
>
> Andrew Thompson wrote:
>
>>On 26 May 2005 05:24:37 -0700, DKM wrote:
>>
>>JS <-> Applet (connected via LiveConnect) to manipulate DOM.
>>
>>
>>>Will this work in Netscape, Internet
>>>Explorer and Mozilla browsers?

>>
>>I do not know. Try it and report back.
>>
>>[ That also depends upon whether you can even get the JS to
>>work across the chosen browsers - no easy feat. ]

>
>
> I have it working in IE and Firefox using only javascript. But, I know
> what you mean, I had to dig into the dom of both the browsers to
> understand what is implemented and what is not and determine the common
> denominator.
>
> As for reporting back on utilizing Liveconnect, that may take a while.
> I have to learn an enormous amount before I start coding for the
> browser plug-in.
>
> Do you know of any simple example of a browser plug-in written in Java
> that does a simple thing like changing the color or text of any
> element.
>
> Thank you very much in advance.
>
> D.K. Mishra
>


<http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/java_js.html>

Example getting & setting document.cookie:
<http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fd6babade3625f00/e439ae0ba5b5b81f>

--
Regards,

Roland de Ruiter
___ ___
/__/ w_/ /__/
/ \ /_/ / \
 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      05-26-2005
On 26 May 2005 07:01:34 -0700, DKM wrote:

> Do you know of any simple example of a browser plug-in written in Java
> that does a simple thing like changing the color or text of any
> element.


Not specifically.

Try to see it this way. Most of the important work with the DOM
should be done by JS, and written in JS. If your applet needs
to trigger that functionality, it should simply call a JS method
that encapsulates the relevant commands.

The reason I say that is that manipulating the browser DOM is
really the specialty of JS progammers, and you would be best
off asking them on the JS group..
<http://groups-beta.google.com/group/comp.lang.javascript>

[ I have seen some horrendous Javascript written by Java programmers,
and what's worse - they actually think they know what they are doing. ]

In fact, most of your basic testing can be done with HTML buttons
and such pretending to be the applet. Once you have figured how
to manipulate the DOM to your satisfaction, put the applet in to
control it all.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
DKM
Guest
Posts: n/a
 
      05-26-2005


Roland wrote:
> On 26-5-2005 16:01, DKM wrote:
> >
> > Andrew Thompson wrote:
> >
> >>On 26 May 2005 05:24:37 -0700, DKM wrote:
> >>
> >>JS <-> Applet (connected via LiveConnect) to manipulate DOM.
> >>
> >>
> >>>Will this work in Netscape, Internet
> >>>Explorer and Mozilla browsers?
> >>
> >>I do not know. Try it and report back.
> >>
> >>[ That also depends upon whether you can even get the JS to
> >>work across the chosen browsers - no easy feat. ]

> >
> >
> > I have it working in IE and Firefox using only javascript. But, I know
> > what you mean, I had to dig into the dom of both the browsers to
> > understand what is implemented and what is not and determine the common
> > denominator.
> >
> > As for reporting back on utilizing Liveconnect, that may take a while.
> > I have to learn an enormous amount before I start coding for the
> > browser plug-in.
> >
> > Do you know of any simple example of a browser plug-in written in Java
> > that does a simple thing like changing the color or text of any
> > element.
> >
> > Thank you very much in advance.
> >
> > D.K. Mishra
> >

>
> <http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/java_js.html>
>
> Example getting & setting document.cookie:
> <http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fd6babade3625f00/e439ae0ba5b5b81f>
>


That should do it. Thank you very much for the links, specially the one
with example at Google archives.

D.K. Mishra

> --
> Regards,
>
> Roland de Ruiter
> ___ ___
> /__/ w_/ /__/
> / \ /_/ / \


 
Reply With Quote
 
DKM
Guest
Posts: n/a
 
      05-26-2005


Andrew Thompson wrote:
> On 26 May 2005 07:01:34 -0700, DKM wrote:
>
> > Do you know of any simple example of a browser plug-in written in Java
> > that does a simple thing like changing the color or text of any
> > element.

>
> Not specifically.
>
> Try to see it this way. Most of the important work with the DOM
> should be done by JS, and written in JS. If your applet needs
> to trigger that functionality, it should simply call a JS method
> that encapsulates the relevant commands.


I understand. I was just looking for a starting point because I am
completely new to all this.

I have now found such an example now posted here in this newsgroup.

Thank you again for the help and the direction.

D.K. Mishra

>
> The reason I say that is that manipulating the browser DOM is
> really the specialty of JS progammers, and you would be best
> off asking them on the JS group..
> <http://groups-beta.google.com/group/comp.lang.javascript>
>
> [ I have seen some horrendous Javascript written by Java programmers,
> and what's worse - they actually think they know what they are doing. ]
>
> In fact, most of your basic testing can be done with HTML buttons
> and such pretending to be the applet. Once you have figured how
> to manipulate the DOM to your satisfaction, put the applet in to
> control it all.
>
> --
> Andrew Thompson
> http://www.PhySci.org/codes/ Web & IT Help
> http://www.PhySci.org/ Open-source software suite
> http://www.1point1C.org/ Science & Technology
> http://www.LensEscapes.com/ Images that escape the mundane


 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      05-26-2005
On 26 May 2005 11:26:07 -0700, DKM wrote:

> I have now found such an example now posted here in this newsgroup.


Yes. I see Roland's prepared a good, solid example there.
It sounds like you are set to go.

> Thank you again for the help and the direction.


You're welcome.

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
DKM
Guest
Posts: n/a
 
      05-28-2005


Roland wrote:
> On 26-5-2005 16:01, DKM wrote:
> >
> > Andrew Thompson wrote:
> >
> >>On 26 May 2005 05:24:37 -0700, DKM wrote:
> >>
> >>JS <-> Applet (connected via LiveConnect) to manipulate DOM.
> >>
> >>
> >>>Will this work in Netscape, Internet
> >>>Explorer and Mozilla browsers?
> >>
> >>I do not know. Try it and report back.
> >>
> >>[ That also depends upon whether you can even get the JS to
> >>work across the chosen browsers - no easy feat. ]

> >
> >
> > I have it working in IE and Firefox using only javascript. But, I know
> > what you mean, I had to dig into the dom of both the browsers to
> > understand what is implemented and what is not and determine the common
> > denominator.
> >
> > As for reporting back on utilizing Liveconnect, that may take a while.
> > I have to learn an enormous amount before I start coding for the
> > browser plug-in.
> >
> > Do you know of any simple example of a browser plug-in written in Java
> > that does a simple thing like changing the color or text of any
> > element.
> >
> > Thank you very much in advance.
> >
> > D.K. Mishra
> >

>
> <http://java.sun.com/j2se/1.5.0/docs/guide/plugin/developer_guide/java_js.html>
>
> Example getting & setting document.cookie:
> <http://groups-beta.google.com/group/comp.lang.java.programmer/browse_thread/thread/fd6babade3625f00/e439ae0ba5b5b81f>
>


I installed JDK 1.4.2.8 in the directory e:\java. I found plugin.jar in
e:\java\jre\lib. I created the environment variable classpath and set
it to "e:\java\jre\lib". I also added "e:\java\bin" to the path
environment variable. I can verify that it has been set by doing the
following:

echo %classpath%

I copied the example and saved it as sgcookie.java and the acompanying
html file as demo.html.

Next, I tried to compile sgcookie.java by the following command:

javac sgcookie.java

it gives lot of error about JSObject. Aparently, it can't find
plugin.jar.

But, if I compile with the -classpath option as follows:

javac -classpath "e:\java\jre\lib\plugin.jar" sgcookie.java

it compiles just fine. The demo html works fine too.

My question is this, whats the point of creating the environment
variable classpath if the compiler can't locate the whatever jar file
it needs in the classpath.

Thanks in advance.

D.K. Mishra

> --
> Regards,
>
> Roland de Ruiter
> ___ ___
> /__/ w_/ /__/
> / \ /_/ / \


 
Reply With Quote
 
Andrew Thompson
Guest
Posts: n/a
 
      05-29-2005
On 27 May 2005 20:39:54 -0700, DKM wrote:

> whats the point of creating the environment
> variable classpath if the compiler can't locate the whatever jar file
> it needs in the classpath.


Long ago Sun gave advice on how to add jars and classes to the classpath.

For som years now they have been saying that was a bad idea and that you
should set paths at the time of compilation or execution.

Now that you have compiled the example, you can add it to the applet's
classpath using the 'archive' element of the <applet> tag.

(By the way. Please trim the posts you are replying to, including
only what is necessary.)

--
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
web app that can interact with other applications on the server Steve ASP .Net 10 07-13-2005 06:53 PM
how does the freetextbox interact with other html elements?? =?Utf-8?B?RGljazIwMDQ=?= ASP .Net 0 11-03-2004 04:20 PM
Getting Windows Controls to Interact with Web Controls lltaylor ASP .Net 1 06-30-2004 07:16 AM
Mozilla new versions interact Franck Henry Firefox 1 05-14-2004 10:52 AM
how to interact client script within aspx page to other page functions, etc.? PLEASE!!! KathyB ASP .Net 0 07-04-2003 09:24 PM



Advertisments