From ripley@stats.ox.ac.uk  Sat Oct  6 15:51:48 2001
From: ripley@stats.ox.ac.uk (Prof Brian D Ripley)
Date: Sat, 6 Oct 2001 15:51:48 +0100 (GMT Daylight Time)
Subject: [Rd] Difficulties lauching HTML pages on Unix (was calling
 browser in Windows)
In-Reply-To: <Pine.LNX.4.30.0110021342140.30794-100000@bolker.zoo.ufl.edu>
Message-ID: <Pine.WNT.4.31.0110061542000.1088-100000@tern.stats>

I changed the title, because this is not about browser() but about HTML
viewers, and the problem is on Unix not Windows.

On Tue, 2 Oct 2001, Ben Bolker wrote:

>   I'm working on the interface to LiveGraphics3D (Java applet for dynamic
> 3D graphics) that I mentioned earlier on the list, and I've hit a
> cross-platform problem.

I think it's a within-Unix-platform problem, mainly.  The other two ports
have a simple procedure: it's Unix/Linux where the problems arise.

>   I want to allow the option of popping up a browser or opening the file
> in a browser automatically.  On Unix, the following (stolen from
> help.start()) works:
>
> system(paste(browser, " -remote \"openURL(", url, ")\" 2>/dev/null || ",
>                browser, " ", url, " &", sep = ""))

And last time we tested this that only works if the browser is netscape
4.7x, so the freedom is illusory.

> If I want to do this in Windows, options("browser") is NULL.  (For now I'm
> hardcoding browser to "C:/PROGRA~1/INTERN~1/IEXPLORE.EXE", but this
> clearly isn't a general solution.) The syntax of the call is also
> different (IE at least appears to require just the file name, "file:/"
> just seems to confuse it).  I don't know how to start a browser in the
> background, or do the equivalent of -remote ...  help.start() is
> considerably more internalized on Windows, so I'm not getting much useful
> there.

Look at help, just as you should for Unix.

>   Here's what I'm doing now:
>
>   mach <- machine()
>   if (mach=="Unix") {
>     url <- paste("file:",file.path(getwd(),fn),sep="")
>     system(paste(browser, " -remote \"openURL(", url, ")\" 2>/dev/null ||
> ",
>                  browser, " ", url, " &", sep = ""))
>   }
>   else if (mach=="Windows") {
>     system(paste(browser,file.path(getwd(),fn)))
>   }
> }
>
>
>   Is there a different idiom I should be using for Windows?

?shell.exec

>   I suppose it's all completely different for the Mac too ...

(A better way to say this is that is completely different under Unix, but
Mac and Windows are similar.)

>   Might it be possible to standardize this interface?

Yes, one might be able to persuade the Unix world to agree on one ....
What help() does does not even work with Netscape 6.01 (and I have yet to
try it with 6.1).

-- 
Brian D. Ripley,                  ripley@stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272860 (secr)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] Difficulties lauching HTML pages on Unix (was calling browser in Windows)
Prof Brian D Ripley