I am having trouble getting an iframe to display correctly on my private Streamlit Cloud deployed app.
I am trying to embed a Metabase dashboard inside my Streamlit app. Locally, the iframe works just fine (pictured).
The example iframe from the Streamlit docs is loading in my Streamlit Cloud deployed app, but not my Metabase iframe.
Here is the code used to display my iframe (I made replicated this scenario with dummy data so you can test the code) and my Streamlit version
streamlit==1.10.0
import streamlit.components.v1 as components
import streamlit as st
st.write("Streamlit Docs Example iframe")
components.iframe("https://docs.streamlit.io/en/latest")
st.write("different iframe test")
components.iframe(src="http://smb-analytics-metabase.herokuapp.com/public/dashboard/afefddda-d5d4-43ed-83fd-307eab7ded3c", width=1285, height=1000, scrolling=True)
I have tried:
Chrome and Brave browsers
Using components.html() inplace of components.iframe()
Removing the width=1285, height=1000, scrolling=True arguements of components.iframe()
Rebooting my Streamlit Cloud App
Deleting and Rebuilding my Streamlit Cloud App
None of these things got the iframe to load on the deployed app. Anyone know of a fix ?
When having issues on Streamlit Cloud, it is good to check the console. In this case, the issue is having a URL starting with http instead of https, leading to the following error in the browser console:
Mixed Content: The page at https://randyzwitch-metabase-streamlit-app-0yyn12.streamlitapp.com/ was loaded over HTTPS, but requested an insecure frame http://smb-analytics-metabase.herokuapp.com/public/dashboard/afefddda-d5d4-43ed-83fd-307eab7ded3c. This request has been blocked; the content must be served over HTTPS.
Because Streamlit Cloud is https by default, all embedded content must also be the same. This is in contrast to developing on localhost, which is http (unless you are savvy enough to set up SSL on your local computer, and if so, you probably already understand the issues )
It’s in the browser developer tools…usually when you right-click, it gives you the option like “Inspect this element”, which will then show you all sorts of stuff about the current page. For example, here’s the Chrome version:
Hi, We’re developing an app on streamlit platform and recently we came across couple of challenges where we cannot make the IFrame component responsive
We tried using page config properties but still there’s lot of white spacing on the top & bottom of the iframe.
hey @ragelysium, is your problem responsiveness or the white spacing on the top and bottom? With your example, you can edit the padding at the top by doing something like:
Hello Tyler, The problem we have is with the white spacing on the left, right, top, bottom and we tried giving padding in the markdowns but we still see lot’s of white spacing around the iframe.
not totally sure how to do that, out of curiosity, why would you want to use Streamlit if you just want to put another website on it, and not use anything related to Streamlit? What is the problem you’re trying to solve?
Well the main goal is to build an native app on streamlit, but for time being we want to showcase couple of features of what our product is doing, so that all snowflake customers can able to access it.
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
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.
Performance cookies
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.
Functional cookies
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.
Targeting cookies
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.