Run a command on a computer from a button on a web page using a Bookmark URL
-
This page demonstrates the code in action:
https://www.w3schools.com/code/tryit.asp?filename=FUUM39NOG124This is the code for your HTML page:
<!DOCTYPE html> <html> <body> <h3>A demonstration of how to put a TRIGGERcmd bookmark button on a web page</h3> <p>Click to run Calculator on Russ's computer:</p> <button type="button" id="myBtn" onclick="myFunction()">Try it</button> <p id="demo"></p> <script> function myFunction() { const request = async () => { const response = await fetch( // You can replace this Bookmark URL with your own: 'https://www.triggercmd.com/trigger/bookmark?token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJib29rbWFya3VzZXJfaWQiOiI1OGJiM2E3N2YyZjgzMTUzMjI0NzM1YjYiLCJjb21wdXRlcl9pZCI6IjViNGI5OGE1YTBlMTNhMDAxYmVlZWQ5MiIsImNvbW1hbmRfaWQiOiI1YjRiOThhNmEwZTEzYTAwMWJlZWVkOTMiLCJleHBpcmVzSW5TZWNvbmRzIjoiIiwiaWF0IjoxNTM1ODI2NzUzfQ.Bm5q9_6DMcv3yH09yOtCu8i-NqIK8T9Inhn8NJc8kDM' , { method: 'POST'} ); const body = await response.json(); console.log(body); } request(); } </script> </body> </html>
To get a Bookmark URL for your own command, just click the red Bookmark button next to your command, and copy the URL from your browser's address bar.