小编mad*_*Max的帖子

"data:image/jpg; base64"和Internet Explorer中的jQuery图像预览

我从方法中获得了Base64编码的照片.我以编程方式将其添加为图像的src.然后我使用jQuery lightBox插件来显示图像的预览.在Firefox和Chrome中,一切正常,但在Internet Explorer 9中,图像预览仅显示我的图像的几行.

因此图像不会显示为整体; 它只显示了一小部分.其余的消失了,看起来某些东西在某个时刻停止加载它.Base64很好,在其他Web浏览器中显示整个图像,并且只有Internet Explorer存在问题.

在我的aspx中:

<script type="text/javascript">
    $(function () {
        $('#gallery a').lightBox({ fixedNavigation: true });
    });
</script>

<div id="gallery">
    <a id="aPhoto" runat="server">
        <img alt="photo" id="imgPhoto" runat="server" /></a>
</div>
Run Code Online (Sandbox Code Playgroud)

在我的aspx.cs文件中:

imgPhoto.Attributes.Add("src", "data:image/jpg;base64," + base64Image);
Run Code Online (Sandbox Code Playgroud)

所以我在aspx文件中插入这样的东西:

imgPhoto.Attributes.Add("src", "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg==");
Run Code Online (Sandbox Code Playgroud)

如何修改它以使用Internet Explorer?

asp.net jquery uri internet-explorer-9

7
推荐指数
1
解决办法
1万
查看次数

标签 统计

asp.net ×1

internet-explorer-9 ×1

jquery ×1

uri ×1