views:

245

answers:

5

Hi,

Is there any way to communicate between my .exe application and Firefox?

Because, I have my own webpage. I'm using FireFox to browse it.

I have an application (in c++) to process a piece of HTML code from my webpage within FireFox. My application can print something directly to printer (raw print).

Since now, I coudn't access firefox's DOM content (page HTML source) from outside firefox; Also, I coudn't print directly to printer (raw print) from firefox.

Now, I'm looking solution for this problem. Here are my possibilitys:

1.) My web page I can copy my releated text to clipboard.

2.) My web page I can write my releated text to firefox's cookie.

3.) My web page I can write my releated text to a file from client's PC.

4.) Any other way to send my releated text to my .exe application.

But I don't know how can I do: How can I copy to clipboard within firefox, How can I read FireFox's cookie from my .exe application, How can I create file in client's PC.

Is there any way to communicate between my .exe application (in c++) and Firefox?

Regards,

Nuri Akman

A: 

You could write an addon for firefox that allowed some form of integration with your application.

Here is a tutorial on writing firefox addins.

Omar Kooheji
+3  A: 

You have to write an extension for firefox an use its API. For example see nsIProcess: "The nsIProcess interface represents an executable process."

Pierre
+1  A: 

Assuming that your page has a true URL outside of FireFox, you could solve your problem by registering a custom protocol handler. E.g. register "X-myprettyprinter". Then, in FireFox, from http://www.example.com/index.html you can redirect to X-myprettyprinter:http%2D%2Dwww.example.com/index.html. FireFox doesn't know how to handle the X-myprettyprinter protocol so it hands of the URL to the OS which then hands it to your registered application. Bonus: it works for all browsers. Downside: you have to retrieve the URL yourself and render the page again in-process

MSalters
A: 

The best way to do this is to skip the .exe application and just make an ad on for FireFox, Take a look at the FireBug ad-on. It can pull certain codes out of a web page, If you use the API I bet you could do what your .exe program should.

Tony C
A: 

You can use nsIFile and related and write to a file that your app reads.

jeffamaphone