【问题标题】:Spotify Embed code (iframe) won't work in MarkdownSpotify 嵌入代码 (iframe) 在 Markdown 中不起作用
【发布时间】:2020-07-25 23:54:15
【问题描述】:

在 Next.JS 上使用 React-Markdown,帖子页面存储为 Markdown 文件,但由于某些原因,Markdown 文件不会呈现 iFrame。但是,如果我使用标准的 Markdown 编辑器,例如我创建的 markdown-edit.now.sh,则嵌入代码可以正常工作。

关于为什么它不会在我的页面上加载但在

中很好的任何原因

嵌入代码

<iframe src="https://open.spotify.com/embed/album/0BRICN5TGMT1WqFcZkYOaF" width="300" height="380" frameborder="0" allowtransparency="true" allow="encrypted-media"></iframe>

【问题讨论】:

    标签: html reactjs markdown next.js


    【解决方案1】:

    试试这个:

    <ReactMarkdown escapeHtml={false} source={blog.content} />
    

    【讨论】:

    • 警告所有经过这里的人:确保您插入到 ReactMarkdown 的内容是安全的,因为这允许危险的 HTML 标签
    【解决方案2】:

    ReactMarkdown 将 iframe 处理为“危险的 html”。要禁用此功能,请执行以下操作:

    <ReactMarkdown allowDangerousHtml={true}>Your content here<ReactMarkdown/>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-09-06
      • 1970-01-01
      • 2018-07-02
      • 2018-12-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-09-11
      相关资源
      最近更新 更多