Search code examples
node.jsgoogle-chromesteam

Open "steam://..." link via nodeJS and Chrome


steam provides links to inspect items in 3D by opening the game and the specific 3D model. Such a link looks like this:

steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561198808861484A14783070567D17060211998222859457  

If this link is clicked in a browser, it asks confirmation to open the "Steam Client Bootstrapper" and then runs the game (or you check a box so it doesn't ask that again).

I would like to make a node script, that would open such a link (probably via chrome) and runs the game.

I tried chrome-launcher:

const chromeLauncher = require('chrome-launcher');

inspect("steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561198808861484A14783070567D17060211998222859457")

function inspect(link){
    chromeLauncher.launch({
      startingUrl: link
    }).then(chrome => {
      console.log(`Chrome debugging port running on ${chrome.port}`);
    });
}

and also the opn module:

const opn = require('opn');

inspect("steam://rungame/730/76561202255233023/+csgo_econ_action_preview%20S76561198808861484A14783070567D17060211998222859457")

function inspect(link){
    opn(link, {app: 'chrome'}); 
}

Both of these have the same result:

  • Chrome opens up
  • Address bar is empty
  • Nothing happens

Any idea on how I could do this?

Thanks in advance!


Solution

  • Remove the app parameter so it uses the standard browser.