Show and Tell - A Dash Component to run your javascript

Hi All,
I use eval function in react.js to run the javascript and create a component.
I’m not sure if it’s safe to use, but it work.

Here is an example for opening url with window.open()

app.layout = html.Div([
    html.Button('open url', id = 'button'),
    visdcc.Run_js(id = 'javascript')
])
           
@app.callback(
    Output('javascript', 'run'),
    [Input('button', 'n_clicks')])
def myfun(x): 
    if x: 
        return "window.open('https://yahoo.com/')"
    return ""
4 Likes

hi Jimmybow

really thanku so much now i am able to click on datatable column to redirect external url… thanks again

1 Like

Thanks jimmybow - works perfectly. I needed to call Tipped.create() to initialize HTML tooltips after they are rendered in Dash. Your package worked great.