Question: I'm looking for a way to render my plot\_ly plot directly to a browser in stead of r-studios default viewer. I've searched the plotly documentation but I only see a reference to the default behavior of opening the plot to a browser when running r from a terminal.

Does anyone know how to open to a browser window by default? Maybe a parameter to the plotly layout() option?

Answer: 
Alright I found a simple solution in the related questions section next to my original question. Sorry I didn't find it before. [stackoverflow.com/questions/36868743](https://stackoverflow.com/questions/33312891/force-rstudio-to-use-browser-instead-of-viewer?rq=1) . 
Setting: options(viewer=NULL) in the script disables the viewer and opens my plot in the browser.
Not really elegant and how to turn the default viewer back on is still a little mystery.
An example from this site might help:

<http://www.statsblogs.com/2014/02/06/protected-online-r-and-plotly-graphs-canadian-and-u-s-maps-old-faithful-with-multiple-axes-overlaid-histograms/>

```
library(plotly)
p <- plotly(username="MattSundquist", key="4om2jxmhmn")
library(maps)
data(canada.cities)
trace1 <- list(x=map(regions="canada")$x,
  y=map(regions="canada")$y)

trace2 <- list(x= canada.cities$long,
  y=canada.cities$lat,
  text=canada.cities$name,
  type="scatter",
  mode="markers",
  marker=list(
    "size"=sqrt(canada.cities$pop/max(canada.cities$pop))*100,
    "opacity"=0.5)
  )

response <- p$plotly(trace1,trace2)
url <- response$url
filename <- response$filename
browseURL(response$url)

```

The main take home being `browseURL(response$url)`. Notice the sign in as well.