Question

After having installed and run a JNLP application, is it possible to use navigator.mimeTypes via javascript in a browser to detect the expected mime-type? While using Chrome on OSX we have noticed that the mime-type does not appear in the navigators list.

var isSupported = navigator.mimeTypes['application/x-my-own-app'];

This was registered via JNLP like so:

IntegrationService is = null;
try {
    is = (IntegrationService) ServiceManager.lookup("javax.jnlp.IntegrationService");
    if (!is.hasAssociation("application/x-my-own-app", new String[] { "myownapp", "moa" })) {
        if (!is.requestAssociation("application/x-my-own-app", new String[] { "myownapp", "moa" })) {
            System.err.println("Association creation failed");
        }
    }
 } catch (UnavailableServiceException use) {
     System.err.println("Integration service unavailable");
 }

If for whatever reason it is not possible to access the registered mime-type in the browser, is there another means to obtain the existence of a registration?

Edit

The process goes like this:

  1. User's first visit to the page, they directed to a .jnlp link
  2. JNLP app downloads and runs; it also registers its mime-type

On subsequent visits:

  1. The page (javascript) checks for the mime-type registration
  2. If the registration is not found the user is directed to the .jnlp link. If the registration is found they are directed to the .moa link.
Was it helpful?

Solution 2

Unfortunately the registration performed by JNLP is done so in the operating system, not in the browser. Therefore the navigator cannot provide the registration required for my use.

OTHER TIPS

Use IntegrationService.hasAssociation(String,String[]).

So that it can be determined that the app is already installed and that we don't need to direct the user to a .jnlp file, but instead to a .moa or .myownapp item.

Use a (light, small) JNLP based applet to do the detection in the browser.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top