Is there any way to communicate between my .exe application and Firefox?
有没有办法在我的.exe应用程序和Firefox之间进行通信?
Because, I have my own webpage. I'm using FireFox to browse it.
因为,我有自己的网页。我正在使用FireFox来浏览它。
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).
我有一个应用程序(用c ++)来处理FireFox中我的网页上的一段HTML代码。我的应用程序可以直接打印到打印机(原始打印)。
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.
从现在开始,我不能从firefox外部访问firefox的DOM内容(页面HTML源代码);另外,我不能直接从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.
1.)我的网页我可以将我的相关文本复制到剪贴板。
2.) My web page I can write my related text to Firefox's cookie.
2.)我的网页我可以将我的相关文本写入Firefox的cookie。
3.) My web page I can write my related text to a file from client's PC.
3.)我的网页我可以将我的相关文本写入客户端PC的文件中。
4.) Any other way to send my related text to my .exe application.
4.)将我的相关文本发送到我的.exe应用程序的任何其他方式。
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.
但我不知道怎么办:如何在firefox中复制到剪贴板,如何从我的.exe应用程序中读取FireFox的cookie,如何在客户端的PC中创建文件。
Is there any way to communicate between my .exe application (in c++) and Firefox?
有没有办法在我的.exe应用程序(在c ++中)和Firefox之间进行通信?
4 个解决方案
#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
假设您的页面在FireFox之外有一个真正的URL,您可以通过注册自定义协议处理程序来解决您的问题。例如。注册“X-myprettyprinter”。然后,在FireFox中,您可以从http://www.example.com/index.html重定向到X-myprettyprinter:http%2D%2Dwww.example.com / index.html。 FireFox不知道如何处理X-myprettyprinter协议,因此它将操作系统的URL移交给操作系统,然后操作系统将其交给您注册的应用程序。奖励:它适用于所有浏览器。缺点:您必须自己检索URL并在进程中再次呈现页面
#2
You have to write an extension for firefox an use its API. For example see nsIProcess: "The nsIProcess interface represents an executable process."
你必须为firefox写一个扩展,并使用它的API。例如,请参见nsIProcess:“nsIProcess接口表示可执行进程。”
#3
You could write an addon for firefox that allowed some form of integration with your application.
您可以为firefox编写一个插件,允许与您的应用程序进行某种形式的集成。
Here is a tutorial on writing firefox addins.
这是一个关于编写firefox插件的教程。
#4
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.
执行此操作的最佳方法是跳过.exe应用程序,只为FireFox制作广告,请查看FireBug广告。它可以从网页中提取某些代码,如果你使用API,我打赌你可以做你的.exe程序应该做的事情。
#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
假设您的页面在FireFox之外有一个真正的URL,您可以通过注册自定义协议处理程序来解决您的问题。例如。注册“X-myprettyprinter”。然后,在FireFox中,您可以从http://www.example.com/index.html重定向到X-myprettyprinter:http%2D%2Dwww.example.com / index.html。 FireFox不知道如何处理X-myprettyprinter协议,因此它将操作系统的URL移交给操作系统,然后操作系统将其交给您注册的应用程序。奖励:它适用于所有浏览器。缺点:您必须自己检索URL并在进程中再次呈现页面
#2
You have to write an extension for firefox an use its API. For example see nsIProcess: "The nsIProcess interface represents an executable process."
你必须为firefox写一个扩展,并使用它的API。例如,请参见nsIProcess:“nsIProcess接口表示可执行进程。”
#3
You could write an addon for firefox that allowed some form of integration with your application.
您可以为firefox编写一个插件,允许与您的应用程序进行某种形式的集成。
Here is a tutorial on writing firefox addins.
这是一个关于编写firefox插件的教程。
#4
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.
执行此操作的最佳方法是跳过.exe应用程序,只为FireFox制作广告,请查看FireBug广告。它可以从网页中提取某些代码,如果你使用API,我打赌你可以做你的.exe程序应该做的事情。