Michael Spector
Michael Spector

Reputation: 37009

How to declare Chrome extension to handle specific URL scheme?

I'd like to write an extension that handles specific URLs that have custom scheme (myscheme://). How do I declare my extension so it is invoked on such a request and intercepts it? (The URL can be clicked, typed directly in the address bar, passed in the command line, etc.). This is probably a beginner question, but I'm a beginner!

Upvotes: 8

Views: 3051

Answers (1)

abraham
abraham

Reputation: 47833

There is a JavaScript API that you can use for this.

navigator.registerProtocolHandler("mailto",
                                  "https://www.example.com/?uri=%s",
                                  "Example Mail");

Upvotes: 3

Related Questions