Hello,
I’m trying to create a link in a dash app to an external site to open in a new tab.
I tried to add target="_blank"
to the dcc.Link("Link to external site", href=url, target="_blank")
but dash doesn’t like it.
Also tried to use html.A("Link to external site", href=url, target="_blank")
but this didn’t work either.
Appreciate any help (perhaps there is a trivial one I’m missing).
Thanks
@bkelemen - This works for me. Here’s what I did:
import dash_html_components as html
app = dash.Dash()
app.layout = html.Div([
html.A("Link to external site", href='https://plot.ly', target="_blank")
])
if __name__ == '__main__':
app.run_server(debug=True)
Could you post a small, reproducable example?
6 Likes
Chris, thanks a lot!
Now I’m not sure what I did yesterday to not get it working as the code works perfectly. Sorry for that.
cs291
4
It works well for me, how to stylize this?