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.