How to remove the ".Streamlit" from the web page title?

after did st.set_page_config(page_title=‘MyApp’)

the web page title will become MyApp.Streamlit

Hope we can remove this from page title

Hi @BeyondMyself,

Thanks for sharing with the Streamlit community!

Can you provide a code snippet or link to your app to help us understand your question?

Best,

Caroline

import streamlit as st
st.set_page_config(page_title=‘MyApp’)

after run this code, you can see that web page title will change into “MyApp●Streamlit”

my target is remove the “●Streamlit” from the web page title, do you have any solutions?

Hello @BeyondMyself ,

Sorry to hear you bumped on this, this is still a known issue you can find here:

There is a hacky solution there to edit your Streamlit installation to remove the ●Streamlit part, just note you will need to do it every time you update Streamlit.

You can +1 the issue to bring more attention to it.

Cheers,
Fanilo

the way of changing document.title in main.*.chunk.js file is not work.
●Streamlit is still exists in page title.
we need a new solution.

Hello @BeyondMyself,

So here’s another very hacky solution. You just have to add and call the following function in your app.

def set_page_title(title):
    st.sidebar.markdown(unsafe_allow_html=True, body=f"""
        <iframe height=0 srcdoc="<script>
            const title = window.parent.document.querySelector('title') \
                
            const oldObserver = window.parent.titleObserver
            if (oldObserver) {{
                oldObserver.disconnect()
            }} \

            const newObserver = new MutationObserver(function(mutations) {{
                const target = mutations[0].target
                if (target.text !== '{title}') {{
                    target.text = '{title}'
                }}
            }}) \

            newObserver.observe(title, {{ childList: true }})
            window.parent.titleObserver = newObserver \

            title.text = '{title}'
        </script>" />
    """)


set_page_title("My new title")

This will however add a small padding where you’ll call the function.

:warning: Caution though, for security reasons, do not let the app user change that title with a text_input.

set_page_title("🎈 My title")  # OK
set_page_title(st.text_input("Edit my title"))  # Security risks
5 Likes

well down, this function works after app restarted.
thanks for your help.

1 Like

This has been resolved with version 0.84!

1 Like

Thanks a lot for this, it works! Has anyone figured out how to reduce the padding it creates?