2

Is there any way to start an application by using an (already registered) URI scheme from my extension's code?

I want to monitor something through background.js and start an app by URI scheme automatically

Xan
  • 74,770
  • 16
  • 179
  • 206
Lourenci
  • 123
  • 8
  • Unclear what you're asking. Let's see if I understand you: there is an app that is already registered for some scheme (say, `steam:` for example) and you want to invoke that? Or you want to add a scheme for an external app that does not have a scheme yet? – Xan Mar 24 '15 at 22:00
  • Exactly. I have an app that is already registered and I want to start it. – Lourenci Mar 24 '15 at 22:07

1 Answers1

0

You can do so by appending an iframe to your background page.

Again with the Steam example:

var frame = document.createElement("iframe");
frame.src = "steam://open/main";
// Needs to be inserted into document to trigger load
document.body.appendChild(frame);
document.body.removeChild(frame);
Xan
  • 74,770
  • 16
  • 179
  • 206
  • I have only a background.js file, I do not have a html file. So, is it does not work? – Lourenci Mar 25 '15 at 14:25
  • Yes, it does, I tested before posting. Chrome makes a blank HTML document with your scripts inserted, that you can manipulate as usual with DOM methods. It's just not actually a visible document. – Xan Mar 25 '15 at 14:26