Bug: openURL on MS Windows with default browser IE

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
11 messages Options
Reply | Threaded
Open this post in threaded view
|

Bug: openURL on MS Windows with default browser IE

Jeremy Winston-2
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
Reply | Threaded
Open this post in threaded view
|

Re: Bug: openURL on MS Windows with default browser IE

Jeremy Winston-2
Jeremy Winston wrote:
> 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).

Hrmmm.  Even though MS says it's deprecated, the problem
doesn't appear to exist with XP running IE7, nor, strangely,
with NT4 running IE 6.

Could folks running a different combination of MS OS and
IE versions, check to see if running

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

at the command line (or Run box) generates an error, and
report back their findings?

TIA,
-Jeremy
Reply | Threaded
Open this post in threaded view
|

Re: Bug: openURL on MS Windows with default browser IE

ctrueden
Hi Jeremy,

On Windows XP with IE7, I could not duplicate the problem. It also
works fine with Firefox. In addition, Microsoft's solution requires
Microsoft-specific classes (com.ms.*) available only to Visual J++
(not Sun's JVM). So Microsoft's official solution is proprietary (big
surprise). So I would suggest ImageJ stick with the rundll32 solution.

-Curtis

On 2/14/07, Jeremy Winston <[hidden email]> wrote:

> Jeremy Winston wrote:
> > 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).
>
> Hrmmm.  Even though MS says it's deprecated, the problem
> doesn't appear to exist with XP running IE7, nor, strangely,
> with NT4 running IE 6.
>
> Could folks running a different combination of MS OS and
> IE versions, check to see if running
>
> rundll32 url.dll,FileProtocolHandler http://rsb.info.nih.gov/ij/notes.html
>
> at the command line (or Run box) generates an error, and
> report back their findings?
>
> TIA,
> -Jeremy
>
Reply | Threaded
Open this post in threaded view
|

Re: Bug: openURL on MS Windows with default browser IE

Jeremy Winston-2
In reply to this post by Jeremy Winston-2
Curtis wrote:
> On XP with IE7, I could not duplicate the problem.
> It also works fine with Firefox.

Strangely, MS says the problem only manifests when
IE is the default browser.  Go figure.

> In addition, Microsoft's solution requires Microsoft-specific
> classes (com.ms.*) available only to Visual J++ (not Sun's JVM).
> So Microsoft's official solution is proprietary (big surprise).

*sigh*

Well, at least they seem quietly to have fixed the problem in
subsequent versions of the OS/browser, anyway.

> So I would suggest ImageJ stick with the rundll32 solution.

Indeed.  Thanks for the info.

-Jeremy
Reply | Threaded
Open this post in threaded view
|

Re: Bug: openURL on MS Windows with default browser IE

Jon Harman
In reply to this post by ctrueden
Hi,

Very curious.  I had given up on getting IE7 to run my ImageJ applet.  
Whenever I attempted it (starting from the shortcut on the desktop) I
got a java error ("The Java runtime environment cannot be loaded").  
When I saw the posts yesterday I gave the rundll32 command a try, and it
works!  Does anyone know what the difference is?  I want my applet to be
accessible to IE7 users and want to be able to tell them how to fix any
problems.

Thanks for any help,
Jon

Curtis Rueden wrote:

> Hi Jeremy,
>
> On Windows XP with IE7, I could not duplicate the problem. It also
> works fine with Firefox. In addition, Microsoft's solution requires
> Microsoft-specific classes (com.ms.*) available only to Visual J++
> (not Sun's JVM). So Microsoft's official solution is proprietary (big
> surprise). So I would suggest ImageJ stick with the rundll32 solution.
>
> -Curtis
>
> On 2/14/07, Jeremy Winston <[hidden email]> wrote:
>> Jeremy Winston wrote:
>> > 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).
>>
>> Hrmmm.  Even though MS says it's deprecated, the problem
>> doesn't appear to exist with XP running IE7, nor, strangely,
>> with NT4 running IE 6.
>>
>> Could folks running a different combination of MS OS and
>> IE versions, check to see if running
>>
>> rundll32 url.dll,FileProtocolHandler
>> http://rsb.info.nih.gov/ij/notes.html
>>
>> at the command line (or Run box) generates an error, and
>> report back their findings?
>>
>> TIA,
>> -Jeremy
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Bug: openURL on MS Windows with default browser IE

ctrueden
Hi Jon,

Whether your applet works in IE7 should be completely independent of
whether ImageJ's browser launcher logic can properly spawn an IE7
instance at a given URL. Those are two separate functions. Sure, the
rundll32 command will spawn an IE7 instance, but that doesn't depend
on having a Java virtual machine accessible from your IE7.

However, I tried visiting some of the Java demo applets using IE7 on XP:
   http://java.sun.com/applets/jdk/1.4/index.html
and they all work fine on my installation. Do you see the same error
when you try to run these? Or is it just for ImageJ?

-Curtis

On 2/15/07, Jon Harman <[hidden email]> wrote:

> Hi,
>
> Very curious.  I had given up on getting IE7 to run my ImageJ applet.
> Whenever I attempted it (starting from the shortcut on the desktop) I
> got a java error ("The Java runtime environment cannot be loaded").
> When I saw the posts yesterday I gave the rundll32 command a try, and it
> works!  Does anyone know what the difference is?  I want my applet to be
> accessible to IE7 users and want to be able to tell them how to fix any
> problems.
>
> Thanks for any help,
> Jon
>
> Curtis Rueden wrote:
> > Hi Jeremy,
> >
> > On Windows XP with IE7, I could not duplicate the problem. It also
> > works fine with Firefox. In addition, Microsoft's solution requires
> > Microsoft-specific classes (com.ms.*) available only to Visual J++
> > (not Sun's JVM). So Microsoft's official solution is proprietary (big
> > surprise). So I would suggest ImageJ stick with the rundll32 solution.
> >
> > -Curtis
> >
> > On 2/14/07, Jeremy Winston <[hidden email]> wrote:
> >> Jeremy Winston wrote:
> >> > 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).
> >>
> >> Hrmmm.  Even though MS says it's deprecated, the problem
> >> doesn't appear to exist with XP running IE7, nor, strangely,
> >> with NT4 running IE 6.
> >>
> >> Could folks running a different combination of MS OS and
> >> IE versions, check to see if running
> >>
> >> rundll32 url.dll,FileProtocolHandler
> >> http://rsb.info.nih.gov/ij/notes.html
> >>
> >> at the command line (or Run box) generates an error, and
> >> report back their findings?
> >>
> >> TIA,
> >> -Jeremy
> >>
> >
>
Reply | Threaded
Open this post in threaded view
|

Re: Bug: openURL on MS Windows with default browser IE

Jon Harman
Hi,

After trying different things and wasting lots of time I notice the
following:
If I have my.yahoo.com as my home page  AND I am logged in to my AT&T
yahoo account then applets DO NOT work.  If I have a blank page as my
home page then applets do work and I can visit my.yahoo.com without
destroying this ability. If I erase cookies so Yahoo does not know who I
am then I can use this as my home page and applets still work.

So it seems that AT&T is using some sort of Java code that screws things
up for any other applets.

Strange.
Jon
Curtis Rueden wrote:

> Hi Jon,
>
> Whether your applet works in IE7 should be completely independent of
> whether ImageJ's browser launcher logic can properly spawn an IE7
> instance at a given URL. Those are two separate functions. Sure, the
> rundll32 command will spawn an IE7 instance, but that doesn't depend
> on having a Java virtual machine accessible from your IE7.
>
> However, I tried visiting some of the Java demo applets using IE7 on XP:
>   http://java.sun.com/applets/jdk/1.4/index.html
> and they all work fine on my installation. Do you see the same error
> when you try to run these? Or is it just for ImageJ?
>
> -Curtis
>
> On 2/15/07, Jon Harman <[hidden email]> wrote:
>> Hi,
>>
>> Very curious.  I had given up on getting IE7 to run my ImageJ applet.
>> Whenever I attempted it (starting from the shortcut on the desktop) I
>> got a java error ("The Java runtime environment cannot be loaded").
>> When I saw the posts yesterday I gave the rundll32 command a try, and it
>> works!  Does anyone know what the difference is?  I want my applet to be
>> accessible to IE7 users and want to be able to tell them how to fix any
>> problems.
>>
>> Thanks for any help,
>> Jon
>>
>> Curtis Rueden wrote:
>> > Hi Jeremy,
>> >
>> > On Windows XP with IE7, I could not duplicate the problem. It also
>> > works fine with Firefox. In addition, Microsoft's solution requires
>> > Microsoft-specific classes (com.ms.*) available only to Visual J++
>> > (not Sun's JVM). So Microsoft's official solution is proprietary (big
>> > surprise). So I would suggest ImageJ stick with the rundll32 solution.
>> >
>> > -Curtis
>> >
>> > On 2/14/07, Jeremy Winston <[hidden email]> wrote:
>> >> Jeremy Winston wrote:
>> >> > 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).
>> >>
>> >> Hrmmm.  Even though MS says it's deprecated, the problem
>> >> doesn't appear to exist with XP running IE7, nor, strangely,
>> >> with NT4 running IE 6.
>> >>
>> >> Could folks running a different combination of MS OS and
>> >> IE versions, check to see if running
>> >>
>> >> rundll32 url.dll,FileProtocolHandler
>> >> http://rsb.info.nih.gov/ij/notes.html
>> >>
>> >> at the command line (or Run box) generates an error, and
>> >> report back their findings?
>> >>
>> >> TIA,
>> >> -Jeremy
>> >>
>> >
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: Bug: openURL on MS Windows with default browser IE

Jeremy Winston-2
In reply to this post by ctrueden
Curtis Rueden wrote:
> On Windows XP with IE7, I could not duplicate the problem. It also
> works fine with Firefox. In addition, Microsoft's solution requires
> Microsoft-specific classes (com.ms.*) available only to Visual J++
> (not Sun's JVM). So Microsoft's official solution is proprietary (big
> surprise). So I would suggest ImageJ stick with the rundll32 solution.

Thus far, it seems that Windows 2000 with IE 6
is the only combination affected.  NT4 with IE 6
is not affected, and XP with IE7 is not affected.
I have been unable to determine whether it is IE6
or W2K that is the culprit.  I.e., I don't know
if RUNDLL32.EXE (part of the OS) or URL.DLL (part
of IE) is at fault.

It seems to me that a workable kludge would be to
check if the OS is Windows 2000, and if so, if the
URL to be opened ends in .htm or .html, then change
the 'm' to %6D or the 'l' to %6C.


I.e., insert code that accomplishes the following
after line 414 of BrowserLauncher.java
http://rsb.info.nih.gov/ij/docs/source/ij/plugin/BrowserLauncher.java.html#414

   if (System.getProperty("os.name").startsWith("Windows 2000")) {
     if (url.endsWith(".htm")
       Remove url's last char and append "%6D"
     elseif (url.endsWith(".html")
       Remove url's last char and append "%6C"
   }

or something like that.  Anyone care to try?

Thanks,
-Jeremy
Reply | Threaded
Open this post in threaded view
|

Re: Bug: openURL on MS Windows 2000 with default browser IE5 or IE6

Jeremy Winston-2
Jeremy Winston wrote:

> Curtis Rueden wrote:
>> On Windows XP with IE7, I could not duplicate the problem. It also
>> works fine with Firefox. In addition, Microsoft's solution requires
>> Microsoft-specific classes (com.ms.*) available only to Visual J++
>> (not Sun's JVM). So Microsoft's official solution is proprietary (big
>> surprise). So I would suggest ImageJ stick with the rundll32 solution.
>
> Thus far, it seems that Windows 2000 with IE 5 or 6
> is the only combination affected.  NT4 with IE 6
> is not affected, and XP with IE7 is not affected.
> I have been unable to determine whether it is IE6
> or W2K that is the culprit.  I.e., I don't know
> if RUNDLL32.EXE (part of the OS) or URL.DLL (part
> of IE) is at fault.
>
> It seems to me that a workable kludge would be to
> check if the OS is Windows 2000, and if so, if the
> URL to be opened ends in .htm or .html, then change
> the 'm' to %6D or the 'l' to %6C.

After some more digging, here's a better fix (courtesy
of http://mmb.mediachance.com/mmbhelp/FAQdll.htm ), still
using rundll32, but using shell32.dll instead of url.dll:

rundll32 shell32.dll,ShellExec_RunDLL http://rsb.info.nih.gov/ij/notes.html

Assuming that only Windows 2000 (running either IE5 or
IE6) is affected, this would translate into Java-esque
pseudocode inserted in place of line 415 of
BrowserLauncher.java
http://rsb.info.nih.gov/ij/docs/source/ij/plugin/BrowserLauncher.java.html#414

   if (System.getProperty("os.name").startsWith("Windows 2000"))
     String cmd = "rundll32 shell32.dll,ShellExec_RunDLL " + url;
   else
     String cmd = "rundll32 url.dll,FileProtocolHandler " + url;

The shell32.dll approach may work with all versions of
Windows after and including Windows 2000.  (It doesn't
work with Windows NT4, as its shell32.dll does not have
the ShellExec_RunDLL function.)

Of course, I have yet to get any feedback from anyone else
suffering from this problem, so for all I know, there is
something misconfigured with my IE6 or W2K, and no one else
sees this problem.

Feedback appreciated,
-Jeremy
Reply | Threaded
Open this post in threaded view
|

Re: Bug: openURL on MS Windows 2000 with default browser IE5 or IE6

Jason Farlette
Jeremy Winston wrote
Of course, I have yet to get any feedback from anyone else
suffering from this problem, so for all I know, there is
something misconfigured with my IE6 or W2K, and no one else
sees this problem.
I have run into the same problem on a Windows 2000 Server machine.  Unfortunately your work around does not work on this machine.   I get an error in Shell32.dll - missing ShellExec_RunDll.

Jason
Reply | Threaded
Open this post in threaded view
|

Re: Bug: openURL on MS Windows 2000 with default browser IE5 or IE6

Jason Farlette
I found this thread http://www.thescripts.com/forum/thread504150.html which talks about using url.dll and appending a trailing '?' to the URL which works on my machine.  YMMV.

Jason