Search code examples
pluginsbrowserprintingsandboxnpapi

Browser extension for printer support and starting Exe-Files


I am developing a webbased business application (JS/node) that, on some client machines, needs to have access to local printers and programms. The platform on which this capabilities are needed can be assumed as Windows in all cases.

I know that natively a programm running in a browser is not allowed to do such things. So I was told to write a browser plugin using NPAPI or PPAPI. Before I dive into all this stuff. I wanted to ask if anyone knows, if this is the right way or if there is a better one.

What I want to achieve at the end is the following:

a) a website with to buttons (A + B)
b) after pressing A directly (!) printing somethin on a local printer without any other question
c) after pressing B starting (i.e.) notepad.exe

Again the question: Is a browser plugin the right way to achieve this? It would be acceptable if this would work only with one browser type.

Thanks for your help.


Solution

  • An NPAPI plugin is the only way to give a web page the power to launch arbitrary executables on a user's machine, yes.

    If you make such a plugin, you need to be extremely careful with security; e.g., ensuring that it can only be used from a specific, safe, domain, as well as hard-coding the binary to launch if possible so that if the domain whitelisting fails, the damage a malicious page could do will be minimal.