TRIGGERcmd
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Run a command on a computer from a button on a web page using a Bookmark URL

    Instructions
    1
    1
    2.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • RussR
      Russ
      last edited by Russ

      This page demonstrates the code in action:
      https://www.w3schools.com/code/tryit.asp?filename=FUUM39NOG124

      This 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.

      Russell VanderMey

      1 Reply Last reply Reply Quote 0
      • First post
        Last post