Javascript Firefox 或 Chrome 中的 ActiveXObject(不是 IE!)
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7022568/
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
ActiveXObject in Firefox or Chrome (not IE!)
提问by Tjekkles
I am trying to create an ActiveXObject
(to use FieSystemObject
) but it's only supported in IE.
我正在尝试创建一个ActiveXObject
(使用FieSystemObject
),但它仅在 IE 中受支持。
Is there a way I can make it work in Chrome or FF? I need to read all the files in a specific given folder, and list those.
有没有办法让它在 Chrome 或 FF 中工作?我需要读取特定给定文件夹中的所有文件,并列出这些文件。
Well, is there another way to do it?
那么,还有其他方法吗?
采纳答案by tinyd
ActiveX is only supported by IE - the other browsers use a plugin architecture called NPAPI. However, there's a cross-browser plugin framework called Firebreaththat you might find useful.
ActiveX 仅受 IE 支持 - 其他浏览器使用称为 NPAPI 的插件架构。但是,您可能会发现一个名为Firebreath的跨浏览器插件框架很有用。
回答by i100
回答by titi
ActiveX
is supported by Chrome.
ActiveX
Chrome 支持。
Chrome check parameters defined in : control panel/Internet option/Security
.
Chrome 检查参数定义在 : 中control panel/Internet option/Security
。
Nevertheless,if it's possible to define four different area with IE
, Chrome
only check "Internet
" area.
尽管如此,如果可以用 定义四个不同的区域IE
,Chrome
只需选中“ Internet
”区域。
回答by Rajesh Kumar Bhawsar
ActiveX resolved in Chrome!
Hello all this is not the solution but the successful workaround and I have implemented as well.
This required some implementation on client machine as well that why is most suitable for intranet environment and not recommended for public sites. Even though one can implement it for public sites as well the only problem is end user has to download/implement solution.
Lets understand the key problem
Chrome cannot communicate with ActiceX
Solution: Since Chorme cannot communicate with ActiveX but still it can communicate with the API hosted on the client machine. So develop API using .Net MVC or any other technology so that through Ajax call it can communicate with the API and API communicate with the ActiveX object situated on the client machine. Since API also resides in Client machine that why there is no problem in communication. This API works as mediator between Chrome browser and ActiveX.
During API implementation you might encounter CORS issues, Use JSONP to deal with it.
Pictorial view of the solution
ActiveX 已在 Chrome 中解决!
大家好,这不是解决方案,而是成功的解决方法,我也已实施。
这也需要在客户端机器上进行一些实现,这也是为什么最适合内网环境而不推荐用于公共站点的原因。尽管也可以为公共站点实施它,但唯一的问题是最终用户必须下载/实施解决方案。
让我们了解Chrome 无法与 ActiceX 通信的关键问题
解决方案:由于 Chorme 无法与 ActiveX 通信,但它仍然可以与托管在客户端计算机上的 API 通信。因此,使用 .Net MVC 或任何其他技术开发 API,以便通过 Ajax 调用它可以与 API 和 API 与位于客户端机器上的 ActiveX 对象通信。由于API也驻留在客户端机器上,所以通信没有问题。此 API 充当 Chrome 浏览器和 ActiveX 之间的中介。
在 API 实现过程中可能会遇到 CORS 问题,请使用 JSONP 来处理。
解决方案的图示
Other solution : Use URI Scheme like MailTo: or MS-Word to deal with outlook and word application. If your requirement is different then you can implement your customized URI Scheme.
其他解决方案:使用 URI Scheme 像 MailTo: 或 MS-Word 来处理 Outlook 和 Word 应用程序。如果您的要求不同,那么您可以实现自定义的 URI 方案。