I have created an app in Streamlit and I'm trying to integrate it to wordpress. I'm currently trying to embed an iframe with a custom HTML block. The extern javascript code (from streamlit) seems not to be loading.
I tried creating an HTML block with:
<style>
iframe {
border: none;
}
</style>
<iframe src="https://share.streamlit.io/cromato/manabase/main/main.py" width="100%" height="500" allowfullscreen="" sandbox="">
</iframe>
And I'm getting only "You need to enable JavaScript to run this app." as output when I preview or load the site.
CodePudding user response:
To embed Streamlit apps, you have to add "?embedded=true" at the end of the source. You need to add some values on your sandbox attribute : "allow-scripts" and "allow-same-origin". Here is the result :
<style>
iframe {
border: none;
}
</style>
<iframe src="https://cromato-manabase-main-5f3sfp.streamlit.app/?embedded=true" width="100%" height="500" allowfullscreen="" sandbox="allow-scripts allow-same-origin">
</iframe>