Reputation: 4696
I am struggling to find an answer to this question so I was hoping somebody experienced with Chrome apps and extensions could point me in the right direction.
I've not written any extensions or apps before so I am just trying to get to grips with it.
I am currently developing a POS system for my company and it's basically done and ready to go. On completion of a transaction I need to open the Till drawer connected via USB to the clients machine. All the machines will be owned by us therefore I can manually add the extension and app to the machine as well as the exe that opens the till.
I have found some sample apps that I am currently working on and I am successfully passing message between my extension and app. The next stage is to then open the exe via the app.
Can someone please clarify if opening an exe via an app is possible and if so presumably I would do this by adding filesystem permissions
"permissions": [
"fileSystem"
],
Then do I need to use the read methods of the api?
Similarly if it is possible to open an exe, do I access this using
file///C:/path/to/exe
If it is not possible to open an exe, I could potentially install xampp on the customer machine and have a php script execute the exe file. In this instance I would need to post data from the app to the PHP page.
I believe I could use Jquerys post function to do this.
Any help/alternative solutions or resources you are aware that could help me solve the issue would be most appreciated.
Upvotes: 1
Views: 7334
Reputation: 872
It isn't possible by design (for security reasons) to launch an exe directly from an extension without writing some extra native software and your own installer for it. The installer has to drop a special configuration file which specifies a path to your executable, and then your extension can then launch your executable and get a messaging channel to send and receive messages to it.
For details on how to do this, see the "Native Messaging" section at:
https://developer.chrome.com/extensions/messaging
Upvotes: 4