views:

189

answers:

2

I have c++ application to monitor local computer and a HTML5 webpage (offline support) to show statistics. At present my application send data through server to webpage, but it works only on online. Now I want to support full offline mode, so i need to push data directly to webpage to fire javascript events. Is this possible? And is this possible on cross-platforms?

A: 

If you're working with Windows, you can create an ActiveX that will be loaded by your web page. ActiveX objects live in the Windows world, and are much easier to communicate with from a Windows app.

Many users would avoid installing an ActiveX when a web page asks them too, but since you're already installing your app, you can just as well install the ActiveX yourself.

You might also be able to achieve that using Java applets, but I'm not a Java programmer so I can't say for sure.

EDIT:

In light of your edit, you can try the following: given the report HTML file is local, you can have your C++ app create an HTML file with the required report values, and store it near the report HTML file whenever there's something to report. In the main HTML page, run a loop that will load the values file into an iframe or so, and when loaded extract the values from it and use them in the main report page. This way you're polling rather than being pushed, but the results are the same, and it's platform independent.

eran
+2  A: 

If the C++ application and HTML5 webpage are on the same machine it might be worth adding the server onto the same PC as well. mongoose is an easy to use, lightweight server that you could embed into your C++ application and serve content straight to the browser without having to go online.

indy