javascript 从在 chrome 和 firefox 上运行的 html 页面调用 .dll 函数

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/9430619/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-26 06:38:45  来源:igfitidea点击:

Calling a .dll function from a html page that runs on chrome and firefox

javascriptdllcross-browseractivex

提问by Narayan

I have a dll written in c++. now i need to call the functions in the dll from a html page.

我有一个用 C++ 编写的 dll。现在我需要从 html 页面调用 dll 中的函数。

I have done this by calling the dll in vbscript (Activex) so that i can run the only in IE.

我通过在 vbscript (Activex) 中调用 dll 来做到这一点,这样我就可以在 IE 中运行唯一的。

Now i need to run this on Chrome as well as Firefox.

现在我需要在 Chrome 和 Firefox 上运行它。

What i have to do, whether i have to write in javascript simply or need to develop any extensions for that ?

我必须做什么,是必须简单地用 javascript 编写还是需要为此开发任何扩展?

can anyone give a solution with a simple demo for this?

任何人都可以通过一个简单的演示给出解决方案吗?

Thanks in advance.

提前致谢。

采纳答案by Narayan

Thanks for answers friends.

谢谢朋友解答。

I got another solution. I wrote signed applets to call dll that runs from a html or any web application. It almost run on all browsers.

我得到了另一个解决方案。我编写了签名小程序来调用从 html 或任何 Web 应用程序运行的 dll。它几乎可以在所有浏览器上运行。

Here is the link for sample

这是示例的链接

http://www.javaworld.com/javaworld/jw-10-1998/jw-10-apptowin32.html

http://www.javaworld.com/javaworld/jw-10-1998/jw-10-apptowin32.html

回答by rkosegi

You have no chance until you create non-portable extension for all browsers.

除非您为所有浏览器创建不可移植的扩展程序,否则您没有机会。

Firefox allows you to create XPIextension aka "addon"

Firefox 允许您创建XPI扩展又名“插件”

Chrome has extensions

Chrome 有扩展

There is no cross platform solution for DLL files, however, you can try to create flash or java applet, which will interact with your DLL, it can be "portable" enough for you.

DLL 文件没有跨平台的解决方案,但是,您可以尝试创建 flash 或 java 小程序,它们将与您的 DLL 交互,它对您来说足够“便携”。

回答by Akhil

You can write an NPAPI plugin for both Mozilla and Chrome. Or you can use Firebreath plugin, but there may arise some dependency issue.

您可以为 Mozilla 和 Chrome 编写一个 NPAPI 插件。或者你可以使用 Firebreath 插件,但可能会出现一些依赖问题。