Skip to content

replace deprecated st.components.v1.html with st.iframe#9

Open
Omid-Sedighi-Mornani wants to merge 1 commit into
bouzidanas:masterfrom
Omid-Sedighi-Mornani:master
Open

replace deprecated st.components.v1.html with st.iframe#9
Omid-Sedighi-Mornani wants to merge 1 commit into
bouzidanas:masterfrom
Omid-Sedighi-Mornani:master

Conversation

@Omid-Sedighi-Mornani
Copy link
Copy Markdown

@Omid-Sedighi-Mornani Omid-Sedighi-Mornani commented May 2, 2026

  • Add relevant folders to .gitignore
  • replace deprecated st.components.v1.html with st.iframe

- Add relevant folders to .gitignore
@bouzidanas
Copy link
Copy Markdown
Owner

I am a bit confused about the choice for the replacement. I looked at the docs for st.components.v1.html and they say:

Deprecation notice
st.components.v1.html was deprecated in version 1.56.0 and will be removed in a later version. Use st.html instead.

This indicates that we need to use st.html instead. Is this a version update issue? Meaning, are you using iframe because of the version of Streamlit being used?

I dont have a lot of time to work on and review this atm, so I am asking for clarification here.

@Omid-Sedighi-Mornani
Copy link
Copy Markdown
Author

This indicates that we need to use st.html instead. Is this a version update issue? Meaning, are you using iframe because of the version of Streamlit being used?

You’re right — there is unsafe_allow_javascript=True, so my assumption was incorrect.

My original reasoning was that st.html is not iframe-based (so javascript gets ignored by default), while components.v1.html is, so I went with explicitly using iframes to ensure JS execution was isolated and consistent.
I assumed, that st.html will not work with JS consistently at all.

This is also because of a warning, that I got from the streamlit application using the deprecated components.v1.html:

Please replace st.components.v1.html with st.iframe.

indicating that we should use st.iframe to replace with.

But with unsafe_allow_javascript=True, JS can apparently also work within st.html, so I’ll take another look at that and consider switching the implementation accordingly.
I'll let you know if we stay with the current iframe-Implementation because of inconsistencies with using st.html.

@bouzidanas
Copy link
Copy Markdown
Owner

bouzidanas commented May 3, 2026

But with unsafe_allow_javascript=True, JS can apparently also work within st.html, so I’ll take another look at that and consider switching the implementation accordingly. I'll let you know if we stay with the current iframe-Implementation because of inconsistencies with using st.html.

Thank you. That would help me greatly! I'll try to review as soon as possible and also try to update Streamlit and do some testing to make sure things look good. Hopefully, it wont be too long.

Thanks for catching this and providing a solution!

Also, please let me know if you used AI in development. Im not opposed to AI, but I do have extra checks I go through when AI is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants