问题
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!
回答1:
There is a JavaScript API that you can use for this.
navigator.registerProtocolHandler("mailto",
"https://www.example.com/?uri=%s",
"Example Mail");
来源:https://stackoverflow.com/questions/8428963/how-to-declare-chrome-extension-to-handle-specific-url-scheme