# Custom Protocols
If you want, you can actually create your own protocols to use for your website instead of http
or https
.
You can register your website to work with any protocol, including custom ones that you create.
Here is the list of reserved protocols.
- bitcoin
- geo
- im
- irc
- ircs
- magnet
- mailto
- mms
- news
- nntp
- openpgp4fpr
- sip
- sms
- smsto
- ssh
- tel
- urn
- webcal
- wtai
- xmpp
Here is the simple method to call to register any protocol.
navigator.registerProtocolHandler(
`web+cheese`,
`http://www.example.com/food.html?type=%s`,
`Title`
);
1
2
3
4
5
2
3
4
5
That code would now prompt the user to allow the registration of the protocol. Assuming that this code is running on the website www.example.com
. If the user accepted the registration, then they can use links like:
<a href="web+cheese:mozzarella">Mozzarella</a>
1
The value of the href would then be passed to the website's food.html
page in the querystring parameter type
.
Learn more from this video:
video will be live on Tuesday