Elad Benda2
Elad Benda2

Reputation: 15472

Can a chrome extension be opened when requesting specific external protocol?

I want to write a chrome extension that is triggered when the browser redirect to a specific external protocol: myApp://...

I googled a bit and didn't find an easy meta-data way to do so.

is there a way to define it in the manifest?

I want the extension to open a popup then, and I'll wait for it in my automation testing.

Upvotes: 2

Views: 285

Answers (1)

Xan
Xan

Reputation: 77531

You can, in theory, use a protocol handler with navigator.registerProtocolHandler, but there are limitations:

  • Custom protocols must start with web+ in Chrome, e.g. web+myApp:
  • There is no way to declare this in a manifest; according to this feature request to add that possibility, currently it will pop up an allow/deny infobar for the user.

In any case, opening a popup programmatically is impossible. At most you can open an extension page in a tab.

Upvotes: 1

Related Questions