[R] browseURL question

Gabor Grothendieck ggrothendieck at myway.com
Sat Feb 28 15:44:03 CET 2004

One way to avoid this problem is to create a one line javascript
file which redirects to your url.  That way the shell never 
gets its hands on your url.  After setting the url:

url <- "http://search.yahoo.com/search?p=Bioconductor&ei=UTF-8&fr=fp-tab-web-t&n=20&fl=0&x=wrt"

Run these three lines of code (only tested on Windows/IE):

cat( "<script language=", "javascript", ">location=", 
            url, "</script>\n", sep="\"", file="temp.htm" )

Date:   Sat, 28 Feb 2004 08:00:54 +0000 (GMT) 
From:   Prof Brian Ripley <ripley at stats.ox.ac.uk>
To:   <jtleek at u.washington.edu> 
Cc:   <r-help at stat.math.ethz.ch> 
Subject:   Re: [R] browseURL question 

The problem is the interpretation by the shell used on Unix: on Windows no
shell is used. It seems to me that the Unix version of browseURl should be
quoting `url' in

remoteCmd <- if (isLocal)
switch(basename(browser), "gnome-moz-remote" = , open = url,
galeon = paste("-x", url), kfmclient = paste("openURL",
url), netscape = , mozilla = , opera = , {
paste("-remote \"openURL(", gsub("([,)])", "%\\1",
url), ")\"", sep = "")
else url

either by escaping & by \ or surrounding it by single quotes.

I can't see a simple solution for you with the present R codebase.

On Fri, 27 Feb 2004 jtleek at u.washington.edu wrote:

> I have a quick question about the browseURL function. When I use the
> function in a UNIX environment, I have to use two sets of quotations if
> I have the & symbol in the URL. For Windows I only need to use the first
> set. For example, on Windows:
> browseURL("http://search.yahoo.com/search?p=Bioconductor&ei=UTF-8&fr=fp-tab-web-t&n=20&fl=0&x=wrt";)
> will call up the appropriate website. However, if I use the same command
> under UNIX, the website will be truncated after the first &, but the
> call will work if I use:
> browseURL("'http://search.yahoo.com/search?p=Bioconductor&ei=UTF-8&fr=fp-tab-web-t&n=20&fl=0&x=wrt'";)
> Where I have added single quotes around the URL.Is there any quick method for solving this problem? Thank you very much for your help.
> Jeff Leek
> Graduate Student
> University of Washington
> jtleek at u.washington.edu
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html

Brian D. Ripley, ripley at 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 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595

More information about the R-help mailing list