5

I have a question:

My program will search FireFox windows opened by user. When a user open Firefox and enter any site, I want to search for a keyword in that page's HTML content.

How can I access Firefox's Active Tab's DOM (or HTML content) from outside firefox using my C++ program.

Is it possible? If so, can you give me some idea or links?

If it is not possible, how can I copy text to clipboard within Firefox without installing / setting up anything?

Best regards, Nuri Akman

TessellatingHeckler
  • 27,511
  • 4
  • 48
  • 87
Nuri Akman
  • 792
  • 3
  • 18
  • 41

3 Answers3

2

There is no built-in way to access the DOM of a web page inside Firefox from an external program. You can write an extension that implements some sort of IPC (using sockets or whatever) and communicate with that, but not built-in to Firefox.

Ted Mielczarek
  • 3,919
  • 26
  • 32
  • 1
    Flash does it. How does it do it? – Android Eve Oct 07 '10 at 13:38
  • 1
    @Android, Flash is a plugin in firefox (which is similar to extensions) – Motti Oct 07 '10 at 21:56
  • @Motti, sorry but I have never programmed for Firefox, so I don't understand the distinction between a plugin/extension and ??? Could you please explain? Thanks. – Android Eve Oct 08 '10 at 14:12
  • 2
    @Android, an Extension extends the Firefox's functionality (Ad block, anti virus) a Plugin handles media types the Firefox doesn't know (Flash, Silverlight, video) they are both types of Addons and interact with the DOM the same way (via JavaScript, NPAPI or XPCOM) – Motti Oct 09 '10 at 19:00
  • @Motti, thank you very much. Your ability to articulate your knowledge is impressive. Another +1 for that. – Android Eve Oct 10 '10 at 15:28
  • @Motti, ditto on that last comment: +1 for very clearly articulating something I've never distinguished before – sXe Dec 02 '11 at 02:53
  • Microsoft's Internet Explorer does it (allows an application to use the DOM) with the WebBrowser and InternetExplorer objects. With Microsoft Edge we can use the WebView control to navigate to a page then inject JavaScript into the page that can communicate with the hosting application. – Sam Hobbs Feb 03 '18 at 06:05
1

It can be done through addons

Umair Ahmed
  • 11,238
  • 5
  • 33
  • 39
1

I had vary similar problem. I had to acces some page, then login user, and perform some actions. First I've tried to find something how to control DOM with external application/plugin, but finally I didn't find something useful. The only choise I found for me was controlling the user input. This can be done with Selenium project. You can find some usefull info in other stack overflow question:

How do get Java to drive/control webkit/gecko?

Community
  • 1
  • 1
Bartosz Firyn
  • 2,664
  • 2
  • 21
  • 18