I've noticed that GitHub launched a new "Clone in Mac" button a couple of months ago, which - when clicked - perform an external protocol request:
github-mac://openRepo/REPOURL
Assuming I want to implement a similar feature for my application, I wonder:
- how do buttons degrade if the user browser doesn't support external protocols
- how to register the protocol handler without requiring user action. In other words, how do you tell browser X to use application GitHub.app in case of protocol github-mac, without asking the user to tweak the browser settings?
- I can see in the above URL an openRepo action, which inform the application about the action to perform. What are the common strategies/patterns to dispatch these requests for a Mac application, so that
github-mac://first
does something different fromgithub-mac://second
?
Browsers differ in the way they handle new protocols. Check documentation here where they have documented various Operating Systems. http://kb.mozillazine.org/Register_protocol
Its actually trivial to register a new protocol in Windows and hook it to a executable. I have done this for some apps: http://msdn.microsoft.com/en-us/library/aa767914%28v=vs.85%29.aspx
Also see register a protocol on mac osx?