TL;DR
Is there a way for a web page (using Javascript or anything else) to tell if Firefox (in particular) or any browser (in general) knows how to open a file having a given extension ? Especially when it's a *.jnlp
file ?
Can't rely on MIME type here.
Complete problem
I'm currently refactoring a very old (~15 years old) web application of ours that we're still selling today. This app is formed of two parts: a server-side one almost completely written in PHP and a client-side one developed in Java, served to the client through Java Web Start, using a JNLP file. I know it's now deprecated with Java 11, but we're still using compatible JDKs.
The issue comes from the welcome page from the server which provides the application. It formerly contained some VBScript parts that I now have discarded, as well as some Javascript sections meant to redirect the user either towards the JNLP file location if JWS is available, or the Oracle appropriate page (back then) otherwise. To achieve this, the program used to check is it was supported by doing:
t = navigator.mimeTypes['application/x-java-jnlp-file'];
if (t) { … }
This seemed fair so far but I realized that this MIME type must have been instructed by a plugin, in this particular case the Java's one, which was almost as common as Flash by the time it has been written. When the Java plugin is installed, it should indeed have no difficulty to run a Java Web Start application in particular.
Today, however, this plugin is no longer installed. Only the JDK lies on the disk and JWS applications are run through javaws
command. JNLP files are then associated in the browser as an Open with…
operation the first time they're opened from it.
Thus my question: can we tell if this operation already has been done, so I can directly redirect the page to the file if it's so, or display explicit instructions to the user otherwise ?
Many thanks to everyone.