How do I embed an existing non streamlit webpage to my streamlit app


So I need to embed spotify onto my streamlit app for a project, how would I go about embedding spotify’s homepage onto my app? iirc, iframes only work if I’m going to embed a webpage into my app

Any help is much appreciated

1 Like

Have you checked st.components.v1.iframe? It should work with any url source.

1 Like

Demo with solution & code sample:

Iframe embedding:

For the iframe you can try something like this:

import streamlit as st
import streamlit.components.v1 as components

def run():
    iframe_src = ""
   # You can add height and width to the component of course.

if __name__ == "__main__":

Whole HTML embedding:

As you can read on the Streamlit app I deployed, there’s always a problem with embedding full HTML pages, so you’ll have to find a workaround on your own.

I suggest here (for HTML embedding not iframe) to build an inner HTML component (a webpage within your Streamlit app).
If you BUILD and entire HTML yourself within your app (for structuring purposes and clean code, you can put it in a side file, e.g: and call it within your main, it will render fine as a HTML component unlike calling a webpage from somewhere else (some website work).

PS: You can still embed your GitHub Pages website, even if you use a custom domain name. I personally have few static pages, and tried both a GH Pages with its native URL and a GH Page with a custom domain using, both have HTTPS enabeled, and both were embedded as iframes while if you try to embed it won’t work.


Oh alr! thanks a lot, I’m trying to do exactly that rn, appreciate the help!!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.