Navigatorï¼registerProtocolHandler() æ¹æ³
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Want more browser support for this feature? Tell us why.
Secure context: This feature is available only in secure contexts (HTTPS), in some or all supporting browsers.
Navigator ç registerProtocolHandler() æ¹æ³è®ç¶²ç«å¯ä»¥å°èªå·±è¨»åçºç¹å®éè¨åå®çèçè
ã
èªæ³
js
registerProtocolHandler(scheme, url)
- protocol æ¯ç¶²ç«æ³è¦èçç protocol å稱ï¼ç¨å串表示ã
- uri æ¯è¦çµ¦ handler èçç URI å串ãä½ å¯ä»¥å¨åä¸²è£¡ç¨ "%s" ä¾ä»£è¡¨ escaped éãéè¦èçç URIã
ç¯ä¾
navigator.registerProtocolHandler("mailto",
"https://mail.google.com/mail?view=cm&tf=0&to=%s",
"Google Mail");
éæå»ºç«ä¸å handlerï¼å®å 許 mailto çéçµå°ä½¿ç¨è å¸¶å° Google Mailï¼å°éçµä¸æå®ç email ä½åæå ¥å° URLã
è¦ç¯
| Specification |
|---|
| HTML > # custom-handlers > |