base64字符串转图片

continent 发布于 2016/06/27 17:52
阅读 1K+
收藏 0

base64字符转换成图片,ie6不显示

<div id="returnButtonDiv">
输入验证码:<input type="text" class="inputmust" id="checkCode" value=""><img id="imgCode" src="data:image/jpg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD/2wBDAAYEBQYFBAYGBQYHBwYIChAKCgkJChQODwwQFxQYGBcUFhYaHSUfGhsjHBYWICwgIyYnKSopGR8tMC0oMCUoKSj/2wBDAQcHBwoIChMKChMoGhYaKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCgoKCj/wAARCAAYAFQDASIAAhEBAxEB/8QAHwAAAQUBAQEBAQEAAAAAAAAAAAECAwQFBgcICQoL/8QAtRAAAgEDAwIEAwUFBAQAAAF9AQIDAAQRBRIhMUEGE1FhByJxFDKBkaEII0KxwRVS0fAkM2JyggkKFhcYGRolJicoKSo0NTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqDhIWGh4iJipKTlJWWl5iZmqKjpKWmp6ipqrKztLW2t7i5usLDxMXGx8jJytLT1NXW19jZ2uHi4+Tl5ufo6erx8vP09fb3+Pn6/8QAHwEAAwEBAQEBAQEBAQAAAAAAAAECAwQFBgcICQoL/8QAtREAAgECBAQDBAcFBAQAAQJ3AAECAxEEBSExBhJBUQdhcRMiMoEIFEKRobHBCSMzUvAVYnLRChYkNOEl8RcYGRomJygpKjU2Nzg5OkNERUZHSElKU1RVVldYWVpjZGVmZ2hpanN0dXZ3eHl6goOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4uPk5ebn6Onq8vP09fb3+Pn6/9oADAMBAAIRAxEAPwD12x03Rbjw3od3d6TAv+j2skmxVJdwEdkkKHhwRk8kMMqcgkVpRw+HLfVrx7vT9IisQjO0kkcZjiWNdxkLYCqpXJPXBHOKq6ZaSNDoSXVxE9vc29s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Lg8P+INfmn1fTLoaj4hudWX7LNuWGCRkK72IABHOcZAx1rs/Fcvh/WXEd1eWd7p88EltexpOrfuWUgn5WDDhm+YHjg9epRQBz1v4b8JaNr+n6npVzYy/ZbVbAbLnzPIs0cMEI3ncBj7xGeOTzWr8QtQ+12Ms3hbUtIl1U27xRvPcI8UBIwJWAVyQu4typBKgHGaKKAOO+Gml/8IzpWm6HdT6AYrFUBksr97pHJO6SR98abQWYnALDkjjAz2t7eW+pPb3dnc26TmFZZY1nQtA5UttOxmUNkN91iM9/4mKKAOE+JVxp8+paWNI+yraRadFEkNqVKQgM2IwF4GBgY4wMUUUUAf/Z"/><br>
求解决方法,最好是不用访问服务器在js生成图片

加载中
0
liuleidefeng
liuleidefeng

很抱歉的说ie6 不支持Base64编码的图像,想兼容的话就只能做特殊处理咯!(如果这种小图片比较多,就用css sprite处理吧)现在用ie6的人已经是极少数了,可以考虑放弃了,我们项目现在ie只兼容到ie9!

ps:不是不会做兼容,而是分析过访问日志后发现:为了兼容破IE做了好多工作,却只有那么一两个人在用,何不省下这些时间多做一下其他事儿呢

0
loyal
loyal
js生成...那你怎么保证安全啊?逗我men呢....
0
e
earthdog
你的问题不是base64转图片的问题,而是ie6根本不支持data URL。再怎么转都是白费。
0
辉火
辉火
还在磕IE6,难得难得。我现在前端直接chrome,有空做下IE8兼容,其他浏览器一概不予理睬。
狂飙的小蜗牛
狂飙的小蜗牛
一般情况下都是没空
0
alan-
alan-
什么年代了,还IE6
返回顶部
顶部