Title: Run command on client OS with javascript
Last modified: December 15, 2021

---

# Run command on client OS with javascript

 *  [jholiveira](https://wordpress.org/support/users/jholiveira/)
 * (@jholiveira)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/run-command-on-client-os-with-javascript/)
 * Hi!
 * I’m developing a WordPress plugin, where I want to detect the client’s OS. In
   particular, the Ubuntu version.
 * Most solutions I came across only go as far as detecting that it is a “Linux”.
   I could overcome this, if I could run directly something like: “lsb_release -
   a” and then parse it.
 * Is there a way for me to run a command via Javascript in the client’s OS?
 * I already attempted several solutions that revolve around javascript “child_process”
   and WP wp_enqueue_script, but I did not manage to make it work.
 * [https://github.com/rhysd/node-ubuntu-version/blob/master/index.ts](https://github.com/rhysd/node-ubuntu-version/blob/master/index.ts)
   
   [https://stackoverflow.com/questions/20643470/execute-a-command-line-binary-with-node-js](https://stackoverflow.com/questions/20643470/execute-a-command-line-binary-with-node-js)
 * Can anyone help?
 * Thank you!
    Jhonny

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [catacaustic](https://wordpress.org/support/users/catacaustic/)
 * (@catacaustic)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/run-command-on-client-os-with-javascript/#post-15164135)
 * There’s no way for you to do that. Broswers won’t allow any sort of execution
   on users PCs like that – for very good reason.
 * Imagine if you could run that command. That also means that any other person 
   coudl run any other command as well. Would you want _any_ webiste that you visit
   to have shell/terminal access to your computer?
 * The example that you’ve linked to with NodeJS isnt applicable here. Node runs
   on the server, not in the browser, so it has permissions to do things like this.
   Normal JavaScript that runs in a users browser doesn’t.
 *  [MK](https://wordpress.org/support/users/mkarimzada/)
 * (@mkarimzada)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/run-command-on-client-os-with-javascript/#post-15164177)
 * I’ve used this package a while ago. It parses User Agents, detects devices, clients
   and operating systems. It might worth checking it out.
 * NPM: [https://www.npmjs.com/package/device-detector-js](https://www.npmjs.com/package/device-detector-js)
   
   Composer: [https://packagist.org/packages/matomo/device-detector](https://packagist.org/packages/matomo/device-detector)
 * If you want to use node package, you will need to compile your script and use
   module bundlers to bundle all the dependencies, then enqueue the final script.
 * I hope this helps.
 *  Thread Starter [jholiveira](https://wordpress.org/support/users/jholiveira/)
 * (@jholiveira)
 * [4 years, 5 months ago](https://wordpress.org/support/topic/run-command-on-client-os-with-javascript/#post-15164821)
 * Thank you for you clarifications [@catacaustic](https://wordpress.org/support/users/catacaustic/)!
 * Dear [@mkarimzada](https://wordpress.org/support/users/mkarimzada/), I will investigate
   your suggestions. I’m not a developer and clearly not acquainted with NPM or 
   Composer. So, this might be a challenge! 🙂

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Run command on client OS with javascript’ is closed to new replies.

## Tags

 * [javascript](https://wordpress.org/support/topic-tag/javascript/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 3 participants
 * Last reply from: [jholiveira](https://wordpress.org/support/users/jholiveira/)
 * Last activity: [4 years, 5 months ago](https://wordpress.org/support/topic/run-command-on-client-os-with-javascript/#post-15164821)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
