Streamlit Button Open Popup window of new link

I would like to open a popup window of another streamlit app.

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

def open_page(url):
    open_script= """
        <script type="text/javascript">
            window.open('%s', "mozillaWindow", "popup").focus();
        </script>
    """ % (url)
    html(open_script)

st.text_input('test', on_chane=open_page, args=('https://www.mozilla.org/',))

I found and edited code from here.

I would like to use the text_input to open the popup window when the user hits enter or clicks somewhere else like its normal functionality. When the user hits enter the first time it works exactly how I want it to work. However, after the first time it no longer will open a popup window. Instead I have to reload the page for it to work again once.

Does anyone have any ideas of how to allow this to run multiple times?

Thanks.

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