Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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!

like image 769
Michael Spector Avatar asked Dec 08 '11 09:12

Michael Spector


People also ask

How do I add an extension to a URL?

Find and select the extension you want. Click Add to Chrome. Some extensions will let you know if they need certain permissions or data. To approve, click Add extension.

How do I pin specific extensions in Chrome?

Open the Extensions by clicking the puzzle icon next to your profile avatar. A dropdown menu will appear, showing you all of your enabled extensions. Each extension will have a pushpin icon to the right of it. To pin an extension to Chrome, click the pushpin icon so that the icon turns blue.

How do I enable URL access in Chrome?

Right-click the extension's icon located in the toolbar and then select “Manage Extensions.” Scroll down until you see “Allow Access to File URLs” and toggle the switch to the “On” position.

What is the URL for a Chrome extension?

You can do it on your PC by enabling chrome://flags/#extensions-on-chrome-urls and adding the necessary url, chrome://extensions/ , into "matches" in manifest.


1 Answers

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

navigator.registerProtocolHandler("mailto",
                                  "https://www.example.com/?uri=%s",
                                  "Example Mail");
like image 113
abraham Avatar answered Sep 30 '22 12:09

abraham