Hi guys, this is my first post and I believe that my issue isn´t hard.
I have the code
st.markdown(’’‘Page 2’’’)
But, in my web app streamlit, the target changes to _blank.
How do I fix this?
Thank you so much
Hi guys, this is my first post and I believe that my issue isn´t hard.
I have the code
st.markdown(’’‘Page 2’’’)
But, in my web app streamlit, the target changes to _blank.
How do I fix this?
Thank you so much
Hello @italomarcelo
For including hyperlinks via markdown, the default behaviour is to open the URL on a new tab (which is equivalent to using target="_blank"
in HTML.
For not opening the URL in a new tab, you can use direct HTML code in the st.markdown
element with unsafe_allow_html=True
and ask the URL to be opened in the same tab/window with target = "_self"
.
Here is an example -
st.markdown("""
<a href="https://discuss.streamlit.io/t/change-target-blank-to-target-self/22809" target = "_self">
Page 2
</a>
""", unsafe_allow_html=True)
Hope this helps
Hi @ineelhere, thanks a lot.
your code open the url with target blank too
<a href="https://discuss.streamlit.io/t/change-target-blank-to-target-self/22809" target="_blank" rel="noopener noreferrer">
Page 2
</a>
Rsss, really… I didnt know why this happened.
Thanks!!
Please change target="_blank"
to target="_self"
in your code. That will solve the issue.
Can you please do a hard refresh on your browser with CTRL+Shift+R
or clear cookies/cache and confirm?
this was fixed recently, so just upgrade (to at least 1.8.1)
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
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.
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.
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.
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.