Organizational Research By

Surprising Reserch Topic

how to detect browsers protocol handlers

how to detect browsers protocol handlers  using -'javascript,browser,protocols,moniker'

I have created a custom URL protocol handler.




I have registered a WinForms application to respond accordingly. This all works great.

But I would like to be able to gracefully handle the case where the user doesn't have the custom URL protocol handler installed, yet.

In order to be able to do this I need to be able to detect the browser's registered protocol handlers, I would assume from JavaScript. But I have been unable to find a way to poll for the information. I am hoping to find a solution to this problem.

Thanks for any ideas you might be able to share.

asked Oct 11, 2015 by tseetha
0 votes

Related Hot Questions

15 Answers

0 votes

This would be a very, very hacky way to do this... but would this work?

  • Put the link in as normal...
  • But attach an onclick handler to it, that sets a timer and adds an onblur handler for the window
  • (in theory) if the browser handles the link (application X) will load stealing the focus from the window...
  • If the onblur event fires, clear the timer...
  • Otherwise in 3-5seconds let your timeout fire... and notify the user "Hmm, looks like you don't have the Mega Uber Cool Application installed... would you like to install it now? (Ok) (Cancel)"

Far from bulletproof... but it might help?

answered Oct 11, 2015 by girisha
0 votes

There's no great cross-browser way to do this. In IE10+ on Win8+, a new msLaunchUri api enables you to launch a protocol, like so:


If the protocol is not installed, the failure callback will fire. Otherwise, the protocol will launch and the success callback will fire.

I discuss this topic a bit further here:

answered Oct 11, 2015 by pradip.bhoge
0 votes

HTML5 defines Custom scheme and content handlers (to my knowledge Firefox is the only implementor so far), but unfortunately there is currently no way to check if a handler already exists—it has been proposed, but there was no follow-up. This seems like a critical feature to use custom handlers effectively and we as developers should bring attention to this issue in order to get it implemented.

answered Oct 11, 2015 by ankitarajoria4
0 votes

There seems to be no straightforward way via javascript to detect the presence of an installed app that has registered a protocol handler.

In the iTunes model, Apple provides urls to their servers, which then provide pages that run some javascript:

So the iTunes installer apparently deploys plugins for the major browsers, whose presence can then be detected.

If your plugin is installed, then you can be reasonably sure that redirecting to your app-specific url will succeed.

answered Oct 11, 2015 by sujata naik
0 votes

What seams the most easy solution is to ask the user the first time.

Using a Javascript confirm dialog per example:

You need this software to be able to read this link. Did you install it ?

if yes: create a cookie to not ask next time; return false and the link applies
if false: window.location.href = '/downloadpage/'
answered Oct 11, 2015 by vijayshukla80
0 votes

You can use an embedded iframe to auto switch between the custom protocol and a known one (web or app store), see

answered Oct 11, 2015 by sameer rathore
0 votes

You can try something like this:

function OpenCustomLink(link) {

    var w =, 'xyz', 'status=0,toolbar=0,menubar=0,height=0,width=0,top=-10,left=-10');
    if(w == null) {            
        //Work Fine
    else {
        if (confirm('You Need a Custom Program. Do you want to install?')) {
            window.location = 'SetupCustomProtocol.exe'; //URL for installer
answered Oct 11, 2015 by sujata naik
0 votes

You say you need to detect the browser's protocol handlers - do you really?

What if you did something like what happens when you download a file from sourceforge? Let's say you want to open myapp://something. Instead of simply creating a link to it, create a link to another HTML page accessed via HTTP. Then, on that page, say that you're attempting to open the application for them. If it doesn't work, they need to install your application, which they can do by clicking on the link you'll provide. If it does work, then you're all set.

answered Oct 11, 2015 by vimaldas2005
0 votes

If you have control of the program you're trying to run (the code), one way to see if the user was successful in running the application would be to:

  1. Before trying to open the custom protocol, make an AJAX request to a server script that saves the user's intent in a database (for example, save the userid and what he wanted to do).

  2. Try to open the program, and pass on the intent data.

  3. Have the program make a request to the server to remove the database entry (using the intent data to find the correct row).

  4. Make the javascript poll the server for a while to see if the database entry is gone. If the entry is gone, you'll know the user was successful in opening the application, otherwise the entry will remain (you can remove it later with cronjob).

I have not tried this method, just thought it.

answered Oct 11, 2015 by sameer rathore
0 votes

I was able to finally get a cross-browser (Chrome 32, Firefox 27, IE 11, Safari 6) solution working with a combination of this and a super-simple Safari extension. Much of this solution has been mentioned in one way or another in this and this other question.

Here's the script:

function launchCustomProtocol(elem, url, callback) {
    var iframe, myWindow, success = false;

    if ( === "Internet Explorer") {
        myWindow ='', '', 'width=0,height=0');

        setTimeout(function () {
            try {
                success = true;
            } catch (ex) {

            if (success) {
                myWindow.setTimeout('window.close()', 100);
            } else {

        }, 100);
    } else if ( === "Firefox") {
        try {
            iframe = $("