我正在开发一个可以从 chrome 打开任何外部应用程序的应用程序。我会用 NPAPI 来做,但 Chrome 会放弃它的支持。有人说这是使用 Native Messaging 或 Native Client 实现的唯一方法,但我不知道该怎么做。
我在 Native Client 中尝试过,但system
调用不起作用。
在 JavaScript 中:
naclModule.postMessage('start notepad'); // just an example, I handle it in different way.
在 C++ 中:
virtual void HandleMessage(const pp::Var& var_message) {
if (!var_message.is_string())
return;
system("start notepad.exe");
}