New tab opens locally but not when deployed

Continuing the discussion from A new tab doesn't open up in my web-browser if I run the streamlit-python script:

Hi @thiago I’m having a similar issue using the webbrowser package. When I test it locally, it works as expected and the new tab opens. However, it does not open in the deployed version.

Any ideas why this might be happening?

if st.button('💭 Share Feedback', use_container_width=True):
        url_feedback = ""

webbrowser can open a browser only in the same computer it is running, not in a different computer.

1 Like

Hi @kaankorkmaz

There’s a related conversation here and from this conversation I proposed a tweak as follows:


The following code will open a new page upon clicking on the button:

import streamlit as st
from streamlit.components.v1 import html

def open_page(url):
    open_script= """
        <script type="text/javascript">
  '%s', '_blank').focus();
    """ % (url)

st.button('Open link', on_click=open_page, args=('',))

Hope this helps!

Best regards,


This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.