Get url from

Hey there, I am using st.experimental_get_query_params() and would like to create a shareable link to the outputs of my app. If I have a fixed url, I can do that by attaching the url params to the base url, but I can’t figure out how the hosted public comes up with the base url. It didn’t seem to be based off the commit hash, so I’m not sure what else it could be.

st.markdown("[share](/?param=value)") should do.

If you actually need to get the full url as a string, you use streamlit-javascript like this:

import streamlit as st
from streamlit_javascript import st_javascript

url = st_javascript("await fetch('').then(r => window.parent.location.href)")


Alternatively, this package GitHub - aghasemi/streamlit_js_eval: A custom Streamlit component to evaluate arbitrary Javascript expressions has a built-in method:

from streamlit_js_eval import get_page_location