Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to execute a command line from Google Chrome Extension?

Is it possible to run/execute a command line from a Google Chrome Extension?

For example, an user clicks on specific link and a local shell program is automatically executed.

Currently, my need concerns only Mac OS X.

Merci a lot !

like image 992
fabLouis Avatar asked Jun 08 '16 19:06

fabLouis


People also ask

Can you run CMD from Chrome?

Accessing the crosh shell Just press ctrl + alt + T and this brings you to what's called the crosh shell (command prompt or terminal) on a Chromebook. The crosh shell will now launch in a separate tab of the Chrome browser.

How do I run a command in browser console?

Right-click in a webpage and then select Inspect. DevTools opens. Or, press Ctrl + Shift + J (Windows, Linux) or Command + Option + J (macOS), to directly open the DevTools console. If necessary, click in DevTools to give it focus, and then press Esc to open the Console.


1 Answers

Maybe you can solve your problem with this post from google groups https://groups.google.com/a/chromium.org/forum/#!topic/chromium-extensions/WaG-xr-jzaQ

Specially this:

You will have to use the Native Messaging API. It is more involved than just calling a function. You have to build an executable (the native host, in native code, like C++) that Chrome will start and use Chrome APIs to communicate with it. The native host is run with the same privileges as Chrome and can do or executes whatever it wants (as long as Chrome can, obviously).

For more information http://developer.chrome.com/extensions/messaging.html#native-messaging

like image 86
FOP Avatar answered Sep 17 '22 22:09

FOP