0

Here's the thing.

A two-way communication (RPC-style) is needed between JavaScript on HTML pages provided by a web server online (with session-management and whatnot) and a windows EXE application running on the PC of the website visitor.

Both are parts of the same 'package' and should be able to communicate.

There is the use of a custom protocol for sure, but some browsers like Chrome & Safari sometimes have issues with custom protocol handling, so it is not reliable enough ...

Another possibility is to build a minimal web-server inside the EXE, so the communication would work with all browsers.

It is possible to develop an extension / plugin for each browsers separately, but it's a daunting task..

The usage of flash / java seems not possible for this task because of sandboxing, but I'm not sure about this ??

Do you have any other ideas ?

1 Answer 1

0

You can use an embedded ActiveX (COM) object and communicate between both platforms. I've done it (and would not have believed it possible had I not). It's nasty but it works. In the project I used it on I had no choice (which is about the only reason to ever do this). I built the COM object in C#.net and exposed an interface to COM for use on the page. It goes something like this:

    function doSomethingInteresting() {
        // in your js:
           var obj = document.getElementById('yourObjectId');
           obj.MethodNameDefinedOnYourCOMObject("someParameterValue");
    }

        // and your HTML looks like this; note that you can even catch events thrown from the COM object in Js...
    <body>
    <form>
      <object id="yourObjectId" height="0" width="0" classid="clsid:99999999-9999-9999-9999-999999999999" onerror="oError()" VIEWASTEXT></object>
    <script for="yourObjectId" event="ThisIsTheJavaScriptEventHandlerMethod(parameterName)" language="javascript">
    // event handling here for the COM object
            function yourObjectId::ThisIsTheJavaScriptEventHandlerMethod(parameterName) {
          // you can process the parameterName passed from the object here
            }
    </script>
    </form>
    </body>

Happy coding!

3
  • Tahbaza, the communication is supposed to work on the 4 major browsers, so ActiveX is out of question. Right now IE is not 95% of browser market any more for a long time already ;)
    – Alexander
    Aug 24, 2010 at 9:23
  • The object tag is supported in non-IE browsers, Alexander. Are you saying you must support Linux/Mac?
    – Tahbaza
    Aug 24, 2010 at 12:03
  • yes the object tag is, but the activex technology is not supported by anything else than IE. I maybe missed something, but Firefox / Safari / Chrome do not load activex plugins AFAIK
    – Alexander
    Aug 25, 2010 at 2:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.