需要从浏览器调用客户端DLL [英] Need to call client side DLL from browser

查看:1053
本文介绍了需要从浏览器调用客户端DLL的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我得到了客户的要求,当任何用户刷卡时,他们的详细信息应该在客户端自动捕获到网页中。然而,我们在IE中通过在C#中创建ActiveX控件来做同样的事情。卡服务提供商在客户端和ActiveX控件上安装他们的DLL,我们可以调用他们的DLL并获取详细信息。

I got requirement from client that when any user swipe their card then their details should be capture in web page automatically on client side. However same we are doing in IE by creating ActiveX control in C#. Card service provider install their DLL on client side and from ActiveX control, we can call their DLL and get details.

但现在客户希望在多个浏览器中进行相同的操作,即不支持ActiveX控件的Mozilla Firefox和Chrome。你能告诉我如何从浏览器调用客户端DLL方法吗?

But now client want the same operation in multiple browser, i.e. Mozilla Firefox and Chrome, which does not support ActiveX control. Can you please give me an idea how it is possible to call client side DLL method from browser?

推荐答案

我必须这样做完全相同的事情,我已经使用EdgeJS完成了它。你可以在从前端javascript中加载的DLL调用函数(在客户端javascript中加载dll)

起初,我使用activex进行IE浏览。然后,我不得不将它移植到其他浏览器。诀窍是在V8和CLR之间编组函数,当事件触发时,您将消息发送到javascript。

I had to do the exact same thing and I've done it using EdgeJS. You can find the answer at Call Function from DLL loaded in front-end javascript (load dll in clientside javascript) .
At first, I used activex for IE. Then, I had to port it to other browsers. The trick is to marshal functions between V8 and CLR and when the event triggers you send the message to javascript.


dll将委托函数作为接收处理程序返回。您使用发送处理程序初始化dll。我还没有找到一种从浏览器运行dll的方法,就像使用ActiveX一样。


The dll returns a delegate function as a receive handler. You initialize the dll with the send handler. I haven't found a method to run the dlls from the browser yet as you do with ActiveX.


出于安全原因,您可能无法在客户端javascript中嵌入和运行dll。


It might be that, for security reasons, you might not be able to embed and run dlls in clientside javascript.

stackoverflow问题中的解决方案是在具有Swipe Reader的客户端计算机上运行的节点进程。客户端应用程序连接到运行websocket服务器的节点进程,并通过websocket消息进行通信。我认为你可以在每个平台(Win,Unix,MacOS)上移植它。

The solution in the stackoverflow question is a node process that runs on the client computer that has the Swipe Reader. The client application connects to the node process that runs a websocket server and communicates through websocket messages. I think you can port this on every platform (Win, Unix, MacOS).

另一个解决方案是构建一个C#应用程序(仅当你使用.NET时才有windows,所有平台(如果您只使用CoreCLR)侦听滑动并触发事件以在所有连接的websockets上发送数据。

Another solution is to build a C# application (windows only if you use .NET, all platforms if you only use the CoreCLR) that listens to swipes and triggers an event to send the data on all connected websockets.

这篇关于需要从浏览器调用客户端DLL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆