3

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 possibilities:

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

2.) My web page I can write my related text to Firefox's cookie.

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

4.) Any other way to send my related 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?

4

4 回答 4

3

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

于 2009-07-13T09:49:41.343 回答
1

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 off 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

于 2009-07-13T10:05:16.990 回答
0

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

Here is a tutorial on writing firefox addins.

于 2009-07-13T09:45:15.860 回答
0

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.

于 2009-07-14T19:43:31.563 回答