浏览 2986 次
锁定老帖子 主题:Firefox上读取服务端二进制数据
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-07-23
输入: http://www.xidea.org 贴上代码: 引用 var xhr = new XMLHttpRequest();
var replaceMap = {}; var list = "20ac 81 201a 192 201e 2026 2020 2021 2c6 2030 160 2039 152 8d 17d 8f 90 2018 2019 201c 201d 2022 2013 2014 2dc 2122 161 203a 153 9d 17e 178".split(" ") var i=32; while(i--){ replaceMap[String.fromCharCode(parseInt(list[i],16))] = String.fromCharCode(0x80+i) } function replacer(c){ return replaceMap[c]; } xhr.open("get","http://www.xidea.org/project/jsi/images/logo.gif",false); xhr.overrideMimeType("text/html;charset=ISO-8859-1"); xhr.send(''); prompt('',"data:image/png;base64,"+btoa(String(xhr.responseText).replace(/[\u0100-\uffff]/g,replacer))); 按下:control + Entry 执行代码。 不出意外,应该是这样的: 引用 data:image/png;base64,R0lGODlhoABeANUAAAAAAK+vr5mZmWZmZtnl+2ZmZmSV7afD9T8/P22b7sXFxR8fH87e+YKCgoGp8P///7y8vN/f33l5eU9PTw8PD8XX+DMzM5S289nZ2ezy/e/v77LK9rKysoyMjHei78zMzNjk+p699PX4/oqv8bvQ9+Lr/P///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAUUACYALAAAAACgAF4AAAb/QJNwSCwaj8ikcslsOp/QqHRKrVqv2Kx2y+16taLKxWMoGzaPdLpibrvbnktF9K3bt6JN4n1Wq8l8gWUJG3R3h4hOJXuBB35pB4KSBgkliZeYRGySI48PJWYODAQVgJMGFZmqh6CnIp5knWoZjKeWq7hcIqaSFZ4hfX6bpx6GucdWG6dlF54MBiGwy2fI1VMita6eZRmPw5MJxtbjS9+nvo8jBrJ+2b3k8EoX08yeJGUgj8DLF/FCGhgCYtAAzw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TJZhWzBoVQ0QOR5WUPW2StSGEbM3AUuGO1gneFpHCSGwAWqWRVpHCFgwaaI1a3dASZOmhDY3BvSAS3AgB5R2hViYhVq4hVzYhVcQBAA7
你就可以看到JSI的logo了^_^ 声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2008-07-23
啥原理呢??
另: JSA新版本啥时候发布啊?? 急 急 急 |
|
返回顶楼 | |
发表时间:2008-07-23
用JS对图片文件做base64处理,生成inline image string?
有什么用呢? |
|
返回顶楼 | |
发表时间:2008-07-23
没什么用,就是验证一下js读取二进制数据的方法。
|
|
返回顶楼 | |
发表时间:2008-07-24
就是把个png换成二进制码罢了,以前也测试过用ajax读二进制文件,可以读出来,就是不知道读出来用来干吗
|
|
返回顶楼 | |
发表时间:2008-09-18
晕,ie不支持 data:image/png;base64 base64 code
|
|
返回顶楼 | |