Summary
I have a multipage app with 2 pages when the user interacts to open the second page i want it to open in another tab rather than in the same tab, how can we do that
Debug info
- Streamlit version: 1.25.1
- Python version: 3.8
- Using PipEnv
- OS version: linux
This is possible, but the user will have two different sessions: any information they enter in the first tab will have no bearing on the second, and vice versa.
You can forcibly navigate to a page in your app by including the page in the URL with an HTML link set to open in a new tab:
st.markdown('<a href="/page_name" target="_blank">Go to page</a>', unsafe_allow_html=True)
If you had a page pages/my_page.py
in your repository, this would look like:
st.markdown('<a href="/my_page" target="_blank">Go to page</a>', unsafe_allow_html=True)
(The next version of Streamlit will have a link button element so you wonβt have to manually enter the HTML. Check out the roadmap.
)
1 Like
st.link_button
was released with Streamlit 1.27.0! 
1 Like