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
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. )
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.