Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Call DLL methods from Javascript

Tags:

javascript

dll

I want to call a methods of a dll from javascript.

I followed this article Creating activex objects with c#

Since activeX works in IE only, how should I be able to call those methods from javascript in FireFox or Chrome?

I am already having an application which uses ActiveX object to call Dll Methods, but it works in IE only.

Is there any possible way that will make my application browser Independent?

UPDATED

I used Jquery async AJAX and webservice to call dll methods:

var to_return = $.ajax({
         type: "POST",
         url: "Default.aspx/CallMe", //CallMe is WebService method
         data: "{}", // parameter to pass
         async: false,
         contentType: "application/json; charset=utf-8",
         dataType: "json",
     });

     alert(to_return.responseText);

If CallMe() returns a string it is alerting it as {"d":"True"} where "True" is the string returned from CallMe.

How will I able to get only returned string from it?

Also, if CallMe() method of webservice returns an Object of a class present in that DLL? How can I retrieve that object in JavaScript? and Will I be able to call methods of that class using that returned object?

Please Help.

like image 702
Prasad Jadhav Avatar asked Jul 17 '12 06:07

Prasad Jadhav


1 Answers

You can't just execute a dll method in browser (this is done for security reasons).
In order to execute some compiled code in browser you will have to use a plugin

ActiveX is just a method of implementing browser plugin in IE. All other browsers use different plugin interfaces.
Then if user will install your plugin in browser - this plugin will be available from JS and you can use it to execute some function in dll.

like image 155
VitaliyG Avatar answered Oct 04 '22 01:10

VitaliyG