2

Is it possible to access Chrome/Firefox extensions/plugins like ghostery from a Java program?

The aim is an experimental one to use the ghostery plugin with a client-server application to scan web pages without the use of a web browser.

Michael Petrotta
  • 59,888
  • 27
  • 145
  • 179
  • Possibly solution to your answer here http://stackoverflow.com/questions/2653949/embeding-gecko-webkit-in-java – r0ast3d Oct 25 '11 at 00:37

3 Answers3

3

No, I don't think so.

You might be able to play some games with its JavaScript using a JavaScript-capable Java-based headless browser, though, if you're specifically looking to replicate ghostery functionality.

Dave Newton
  • 158,873
  • 26
  • 254
  • 302
  • Thanks Dave, But can I ask in more details, I am new to the extensions and scripts, I am not looking to replicate the ghostery. what I am looking is to fetch the scripts detected by ghostery and analyse all those scripts. This is my final aim. also will it be possible to do so by Google GWT? – Kaushal Singh Oct 25 '11 at 00:38
  • @user1011840 GWT is a UI library and doesn't have anything to do with fetching scripts. Fetching scripts is trivial, how to identify *which* scripts are "interesting" will be the actual issue. – Dave Newton Oct 25 '11 at 00:46
  • Thanks again dave, what i was initially thinking a work around was to some how call the ghostery as a middle-ware tool to analyse the scripts and get the o/p. can you please guide me in correct direction? – Kaushal Singh Oct 25 '11 at 01:05
  • @user1011840 Not really, but I'd start by looking at its JavaScript to see how it IDs what to grab. – Dave Newton Oct 25 '11 at 01:20
1

From java applets you should be able to call javascript (old school) not sure if that will help you to achieve what you want, but you can access the javascript calls.

r0ast3d
  • 2,639
  • 1
  • 14
  • 18
  • +1; I thought about mentioning that, but since OP wanted to avoid a browser, it seemed like more trouble than it was worth. – Dave Newton Oct 25 '11 at 00:24
0

I don't think you can do what you want... or if you can it would be too much work! If you are wanting to scrap webs, you can easily do it whit a headless browser. There are a lot of headless browsers. I had use PhantomJs (http://phantomjs.org/), obviously in Javascript and super easy to use...

But there others in Java too:

http://jaunt-api.com/
http://htmlunit.sourceforge.net/

(Haven't tried them)

Gonz
  • 1,198
  • 12
  • 26