'Spotify Embed code (iframe) won't work in Markdown
Using React-Markdown on Next.JS, the post pages are stored as Markdown files, but for some reason the Markdown file won't render the iFrame. However if I use a standard Markdown Editor such as the one I created markdown-edit.now.sh the embed code works perfectly fine.
Any reason as to why it wouldn't be loading on my pages but is fine in
Embed Code
<iframe src="https://open.spotify.com/embed/album/0BRICN5TGMT1WqFcZkYOaF" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>
Solution 1:[1]
Try this:
<ReactMarkdown escapeHtml={false} source={blog.content} />
Solution 2:[2]
ReactMarkdown handles iframes as "dangerous html". To disable this just do:
<ReactMarkdown allowDangerousHtml={true}>Your content here<ReactMarkdown/>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | danidemi |
Solution 2 | Hodd |