3

I am writing a protocol handler to launch a java application, calling a command like java -jar myApp '%1'. Currently I have implemented it for Chrome and it looks work correcly. Unfortunately I don't have the same behavior for Firefox and IE (weird uh?! X-D )

Here my implementation.

The protocol is named dgh. During the first installation my application set the following keys in windows registry

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\dgh]
@="URL:DgHome  Protocol"
"URL Procol"=""

[HKEY_CLASSES_ROOT\dgh\DefaultIcon]
@="C:/DGHOME/IPlusConf.exe,1"

[HKEY_CLASSES_ROOT\dgh\shell]

[HKEY_CLASSES_ROOT\dgh\shell\open]

[HKEY_CLASSES_ROOT\dgh\shell\open\command]
@="java -jar C:/DGHOME/Pch/lib/pch.teleconsulto.jar \"%1\""

On chrome this is enough. On Firefox, I had to add some configurations in about:config.Following MDN on Firefox I set the following

network.protocol-handler.expose.dgh;true
network.protocol-handler.external.dgh;true
network.protocol-handler.warn-external.dgh;false

In this way firefox at least ask to me if I want launch an application and ask to me to select one: I don't want that, I would it call the command I set and advise the first time the user about that:

On IE nothing happens, it says can't open the web page reference by my link.

Here a set of link I used as test

<a href="dgh://call/open?id='kit1.teleconsulto'">Open call to kit1.teleconsulto</a>
<a href="dgh://teleconsult/start?id='kit1.teleconsulto'">
   Open teleconsult to kit1.teleconsulto</a>
<a href="dgh://call/close">Close call</a>
<a href="dgh://call/end">Close client</a>
<a href="dgh://stethoscope/start">On Phonendo</a>

here some references: Installing and Registering Protocol Handlers http://msdn.microsoft.com/en-us/library/aa767916%28VS.85%29.aspx

I hope sincerely someone can help me

Alberto R.
  • 161
  • 2
  • 10
  • I know that what I am going to write is not professional and absolutely not polite however I have to do : there is nobody that even imagine how to solve that??! sob :'( :'( :'( – Alberto R. Oct 16 '13 at 10:59

2 Answers2

1

The problem you're having is that the you're calling the jar directly in your protocol handler. You need to invoke java.exe with the -jar parameter

Your registry key should look like this

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\digitalmgi]
@="URL:digitalmgi protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\digitalmgi\DefaultIcon]
@="C:\\myCoolIcon.ico"

[HKEY_CLASSES_ROOT\digitalmgi\Shell]

[HKEY_CLASSES_ROOT\digitalmgi\Shell\Open]

[HKEY_CLASSES_ROOT\digitalmgi\Shell\Open\Command]
@="\"C:\\Program Files\\Java\\jre7\\bin\\java.exe\" -jar \"C:\\MyPath\\myJar.jar\" \"%1\""
dolbysurnd
  • 736
  • 1
  • 6
  • 14
0

I understand that you have taken the approach of Registering in the system's registry but, If you are willing to take a different approach then, there is a Generic solution available at Generic-Protocol-Handler which surely will address the Cross Browser compatibility issue.

Please Mark this as Answer, if it helps :)

Community
  • 1
  • 1