问题
It's been noticed by all web extension developers that Firefox is going to stop SDK support (API that allows shell execution in client side) and will only accept web extensions.
Due to above-mentioned changes, I'm trying to get a shell command executed by javascript code in Firefox's web extensions' API.
I'm dealing with a web page that executes the web extension (I solved it by using javascript events), but the real trouble is that I need to execute a shell command in the javascript main code to open client programs such as LibreOffice or a background Java code and I don't know how to achieve it.
It's also necessary to execute these shell commands on Windows, OSX and Linux.
回答1:
You can't directly run a shell command but native messaging lets you exchange messages with a specific native application that could launch other applications on your extension's behalf: https://developer.mozilla.org/en-US/Add-ons/WebExtensions/Native_messaging
来源:https://stackoverflow.com/questions/44183413/javascript-shell-command-execution-from-firefox-web-extensions