Login  Register

Bug: openURL on MS Windows with default browser IE

Posted by Jeremy Winston-2 on Feb 14, 2007; 7:02pm
URL: http://imagej.273.s1.nabble.com/Bug-openURL-on-MS-Windows-with-default-browser-IE-tp3699891.html

Hi Folks,
     It seems that the approach taken by the openURL method
of BrowserLauncher for MS Windows to open the default web
browser to a URL ending in .htm or .html when the default
browser is IE is deprecated (per MS).  URLs ending in .htm
or .html generate an error pop-up titled "Problem with
shortcut" with message "Unable to open '(whatever).html'"
You can try this yourself from the command line (or from
the Run box):

rundll32 url.dll,FileProtocolHandler http://rsb.info.nih.gov/ij/notes.html

A work-around is to change the last letter of the URL to its
hex equivalent.  E.g.,

rundll32 url.dll,FileProtocolHandler http://rsb.info.nih.gov/ij/notes.htm%6C

Instead, they recommend using ShellExecute.  Cf.
http://support.microsoft.com/kb/283225
I would code up a replacement myself, but (a) I don't know
Java, and (2) I don't have time to learn it ATM.

Anyone care to give it a try?

The relevant code is here:
http://rsb.info.nih.gov/ij/docs/source/ij/plugin/BrowserLauncher.java.html#4
14

Thanks,
-Jeremy Winston