Home
> Uncategorized > Handle custom Url schemes in Chrome / Firefox
Handle custom Url schemes in Chrome / Firefox
If you want to be the go-to site to handle common url schemes (protocols), such as a Gmail wants to handle mailto: links, and so forth, then you can prompt the user to accept your website as the default handler for common uri schemes, using this simple code:
try
{
navigator.registerProtocolHandler(“protocol”, “http://www.yourdomain.com/?to=%s”, “Your site”);
} catch (ex) { }
The Try / Catch is just there for older browsers, or Internet explorer. The script has to be executed from the same domain as mentioned in the protocol handler. Otherwise it’ll be just flatly ignored.
Categories: Uncategorized
Comments (0)
Trackbacks (0)
Leave a comment
Trackback