如何从javascript调用user32.dll方法 [英] How to call user32.dll methods from javascript
问题描述
我在浏览器上运行了一个javascript。是否可以在user32.dll中调用函数/方法。
I have a javascript running on a browser. Is it possible to call a function/method in user32.dll.
通过使用pInvoke调用可以从C#中实现。如何在JavaScript中执行相同操作?
This is possible from C# by using pInvoke calls. How do I do the same in JavaScript?
谢谢,
Datte
推荐答案
由于JavaScript沙箱,如果没有需要提升安全权限的中间层(例如Netscape样式的浏览器插件),则无法做到这一点(广泛使用)支持),ActiveX控件(几乎只有IE),或.Net控件(我认为这是可能的;再次可能只有IE)。在每种情况下,JavaScript都会与控件通信,而控件又会为您调用USER32。
Because of the JavaScript sandbox, you can't do it without a middle layer requiring elevated security permissions, such as a Netscape-style browser plug-in (widely supported), ActiveX control (pretty much IE-only), or .Net control (I assume that's possible; again probably IE-only). In each case, the JavaScript would talk to the control, which would in turn make the USER32 call for you.
如果没有用户授予您的应用程序,这些都不会起作用提升权限,但我猜你正在要求Windows,这适用于某种内联网应用程序,这可能是可能的。
None of that will work without the user having granted your application elevated permissions, but I'm guessing as you're requiring Windows, this is for some kind of intranet application where that may be possible.
这篇关于如何从javascript调用user32.dll方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!