Embed a Spotify player in a shared HTML page
A podcast page, playlist page or event page from Claude or ChatGPT with a Spotify player in it. Which iframe address works, which heights to use, what a wrong ID shows, and how to share the page as a link.
Ask Claude or ChatGPT for a page with a Spotify track, album, playlist or podcast episode and it writes an <iframe>. Whether the player shows depends on the address in src.
The tests below were run in headless Chrome, signed out of Spotify, with a public track and a public Spotify playlist, on a page served over http and on the same file opened from disk.
Use the embed address
Put /embed/ after open.spotify.com: https://open.spotify.com/embed/track/TRACK_ID (or /embed/album/, /embed/playlist/, /embed/episode/, /embed/show/). Tested in an iframe:
- ✓open.spotify.com/embed/track/ID: the player loaded with title, artist and a Play button, over http and from a file:/// address.
- ✓open.spotify.com/embed/playlist/ID: the player loaded with the track list and Previous and Next buttons.
- ✓open.spotify.com/track/ID (the link you copy from the app): "open.spotify.com refused to connect." The page sends a frame-ancestors rule that only lets Spotify frame it.
- ✓open.spotify.com/intl-de/embed/track/ID (a link with a country part): redirected to the plain embed address and loaded.
- ✓An ID that does not exist: "Page not found" inside the frame.
- ✓A spotify:track:ID address as the src: an empty frame.
Pick a height
Spotify's own embed code uses height 152 for a track or episode and 352 for a playlist or album. Tested: at 152 the track player showed title, artist and Play; at 80 it showed a one-line player with Play; at 352 the playlist showed its tracks.
Copy the code from Spotify (Share, then Embed track or Embed playlist) to get the height, width="100%" and an allow attribute. Without allow="encrypted-media; fullscreen", the player still loaded in the test, but it lost fullscreen. Keep the attribute Spotify gives you.
Signed out, the player labelled each track "Preview". Full-length playback depends on the viewer's own Spotify login; that was not tested.
Control the player from your page
Spotify's iFrame API (the script https://open.spotify.com/embed/iframe-api/v1) builds the player from a spotify:track:ID URI and lets your page start or switch tracks. Tested: the controller reported ready over http and from disk.
To get this from an AI tool, ask: "Embed the track with an iframe at https://open.spotify.com/embed/track/TRACK_ID, height 152, and keep Spotify's allow attribute."
Upload it and send the link
Drag the HTML file onto the FileShare Pro dashboard and copy the link. Viewers need no account on FileShare Pro. The shared view allows autoplay, encrypted-media, fullscreen and clipboard-write for your page, so the Spotify player inside it gets the same permissions it asks for.
Change the page and upload a new version over the old one; the link stays the same. Related: a page with an audio player, a Vimeo video in a shared page and a page with an embedded YouTube video.
Frequently asked
Yes. The track, playlist and iFrame API players all loaded from a file:/// address in the test.
No. The audio stays on Spotify; only the HTML file is uploaded.
No. Shared files carry a noindex header: keeping a preview out of Google.
Drop the file, copy the link — live in seconds, free plan included.
Start sharing free