How do I perform a shell execute in a chrome extension?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-18 10:56:24

问题


I'm not finding a way to do this in the chrome.* API or even the experimental. It doesn't run through wscript so ActiveXObject("Shell.Application") isn't allowed.

I fear that my only option is to build a dll with NPAPI but I wanted to see if there was a simpler way.


回答1:


If you want to do anything Natively, you need to use NPAPI. That allows you to run code outside the sandbox for your extensions.

http://code.google.com/chrome/extensions/npapi.html




回答2:


To update this for a fellow wary lonesome traveler, even NPAPI is deprecated and being phased out. One of the alternatives mentioned in the NPAPI decprecation blog post that looks suitable for this type of problem (and pretty nifty really) is the Native Messaging API.




回答3:


Alternatively, you might want to have two applications:

  1. a "client" that works within a chrome extension and
  2. a "local server" where the actual command is executed.

Whenever the extension needs to execute a command, it can connect to the local server via tcp connection.



来源:https://stackoverflow.com/questions/3695476/how-do-i-perform-a-shell-execute-in-a-chrome-extension

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!