# Select default browser to display PlotlyLight.Plot()

**URL:** https://discourse.julialang.org/t/select-default-browser-to-display-plotlylight-plot/99987
**Category:** General Usage
**Tags:** plotlylight
**Created:** [June 7, 2023, 7:11am UTC](https://discourse.julialang.org/t/select-default-browser-to-display-plotlylight-plot/99987 "2023-06-07T07:11:42Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![ellocco](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ellocco/32/31331_2.png) [@ellocco](https://discourse.julialang.org/u/ellocco)
#### Post date: [June 7, 2023, 7:11am UTC](https://discourse.julialang.org/t/select-default-browser-to-display-plotlylight-plot/99987/1 "2023-06-07T07:11:42Z")

</div>

One important feature for a plot package the produces interactive HTML-output is for me the feature to select the default browser to display my HTML-figure. Below a code snippet for the package [plotlylight-jl](https://discourse.julialang.org/t/ann-announcing-plotlylight-jl/76549):

```julia
using PlotlyLight, Cobweb
# ----------------------------------------------------------------------------------------------------------------------------------
# --- PlotlyLight Repository: https://github.com/JuliaComputing/PlotlyLight.jl
# --- documentation: https://plotly.com/javascript/
# ----------------------------------------------------------------------------------------------------------------------------------
# --- proposal to make default browser selectable:
struct MyDisplay <: AbstractDisplay end

pushdisplay(MyDisplay())

function Base.display(::MyDisplay, _myplot::PlotlyLight.Plot) # DataType / # PlotlyLight.Plot  
    Cobweb.save(Cobweb.Page(_myplot)) # overwrite "index.html"
    _filename = joinpath(Cobweb.DIR, "index.html")
    run(`cmd /c start msedge.exe $_filename`)
end

# --- Example Figure, first change template:
# PlotlyLight.Preset.Template.plotly_dark!()

# --- Make plot
p = PlotlyLight.Plot(x = 1:20, y = cumsum(randn(20)), type="scatter", mode="lines+markers");

# --- Make changes
p.layout.title.text = "My Title!"

# --- `display(p)` to see the updated plot
display(p)

```

source: [issues/26](https://github.com/JuliaComputing/PlotlyLight.jl/issues/26)
