【问题标题】:How do I preserve the original img src (disable Data URI) when pasting an image in a Firefox contentEditable div将图像粘贴到 Firefox contentEditable div 中时,如何保留原始 img src(禁用数据 URI)
【发布时间】:2011-12-10 21:16:44
【问题描述】:

我有一个编辑器,其中包含一个 contentEditable=true 的 div,我让用户在其中粘贴剪贴板中的图像,并从编辑器内部更改图像的 SRC 属性。

在 IE 中它工作正常,但在 Firefox 中,图像在粘贴时会自动序列化,即 src 属性变为类似于 data:image/png;base64,iVBORw0KGg...

如何强制 Firefox 保留原始图像源?

【问题讨论】:

    标签: firefox image contenteditable paste data-uri


    【解决方案1】:

    你没有。如果你这样做了,图像根本不会呈现,因为出于安全原因,网页无法链接到 Gecko 中的 file:// URI。

    【讨论】:

    • 我没有使用 file:// 路径。通过使用浏览器本身的“复制图像”功能,图像已被放入剪贴板。它在 Chrome 和 IE 中运行良好,它们足够聪明,可以在粘贴时链接到原始图像源。
    • 啊,这听起来像是 Firefox 应该做的事情。提交错误?
    猜你喜欢
    • 2014-10-01
    • 2012-08-25
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-06-22
    相关资源
    最近更新 更多