browseURL doesn't work, xdg-open not available

1,001 views
Skip to first unread message

xhd...@umd.edu

unread,
Oct 6, 2017, 10:31:14 AM10/6/17
to shinyapps.io Users
In my app I have a button to dynamically generate a report and open that report in a new browser window. This worked well locally but failed in shinyapps.io. The error log is as follows:

2017-10-06T14:18:52.605039+00:00 shinyapps[182623]: [2017-10-06 14:18:52] Work Report Generated  
2017-10-06T14:18:53.131335+00:00 shinyapps[182623]: Couldn't find a suitable web browser!
2017-10-06T14:18:53.131338+00:00 shinyapps[182623]: Set the BROWSER environment variable to your desired browser.
2017-10-06T14:18:53.131465+00:00 shinyapps[182623]: Warning: program returned non-zero exit code #1
2017-10-06T14:18:53.151372+00:00 shinyapps[182623]: WARNING: You don't seem to have any mimeinfo.cache files.
2017-10-06T14:18:53.151373+00:00 shinyapps[182623]: Try running the update-desktop-database command. If you
2017-10-06T14:18:53.151374+00:00 shinyapps[182623]: don't have this command you should install the
2017-10-06T14:18:53.151375+00:00 shinyapps[182623]: desktop-file-utils package. This package is available from
2017-10-06T14:18:53.151376+00:00 shinyapps[182623]: http://freedesktop.org/wiki/Software_2fdesktop_2dfile_2dutils
2017-10-06T14:18:53.175550+00:00 shinyapps[182623]: Can't call method "get_value" on an undefined value at /usr/bin/mimeopen line 162.
2017-10-06T14:18:53.176838+00:00 shinyapps[182623]: /usr/bin/xdg-open: 461: /usr/bin/xdg-open: links2: not found
2017-10-06T14:18:53.177080+00:00 shinyapps[182623]: /usr/bin/xdg-open: 461: /usr/bin/xdg-open: links: not found
2017-10-06T14:18:53.177298+00:00 shinyapps[182623]: /usr/bin/xdg-open: 461: /usr/bin/xdg-open: lynx: not found
2017-10-06T14:18:53.177532+00:00 shinyapps[182623]: /usr/bin/xdg-open: 461: /usr/bin/xdg-open: w3m: not found
2017-10-06T14:18:53.177548+00:00 shinyapps[182623]: xdg-open: no method available for opening '/tmp/RtmpbZwdGq/1c9d17a374b32b22f823db7827f4f2ab/Report_2017-10-06_14-18-17/report.html'


It seemed that `xdg-open` is not installed in server. However I'm also not sure if this will work as intended: even if `xdg-open` is installed, I doubt the server will open a new browser window for user.

If this is not gonna work, another alternatives is that I can create a link in app. User can click the link to open the file. However,
  1. Since the file is dynamically updated at the time of clicking, user need to first to click a button to update the file, then click the click.
  2. I cannot use `file://` url, because 

Note that when pages are loaded with a HTTP(S) protocol (the case of the Shiny app) for security reasons you can't framed locals files with their "file:" URLs. If you want to display locals pdf you should access to them with a http(s): URL, so you have to save them in your www directory (a local web server) and access to files with their http(s): URLs

So that's a lot of work and user still need to click twice.

Andy Kipp

unread,
Oct 6, 2017, 11:37:18 AM10/6/17
to xhd...@umd.edu, shinyapps.io Users
You are correct: opening a browser window is not going to work (you can't execute a program on the clients computer).

My suggestion would be to look into using a downloadHandler, which will prompt the user to download the output file when clicked:

--
You received this message because you are subscribed to the Google Groups "shinyapps.io Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-users+unsubscribe@googlegroups.com.
To post to this group, send email to shinyapps-users@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shinyapps-users/8fc4393c-6932-4242-b2ac-fe89ba288867%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

xhd...@umd.edu

unread,
Oct 6, 2017, 11:59:17 AM10/6/17
to shinyapps.io Users
Download the html is simpler and better than the other alternatives I considered. Though I have a download all button which will download the html, some plot images, csv into a zip already. Downloading html only seemed a little bit duplicated. 

I will consider this option if users want it. Thanks for the idea!
To unsubscribe from this group and stop receiving emails from it, send an email to shinyapps-use...@googlegroups.com.
To post to this group, send email to shinyap...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages