【发布时间】:2013-09-09 03:02:40
【问题描述】:
这是一个典型的 img,其中 src 有一个 blob:
<img class="gwt-Image" src="blob:a7cb8111-cf35-4c3a-8295-bdda0ff66caf">
有没有办法让我的 GWT 应用下载获取他的 blob 数据以进行客户端操作?
我试过这个:
private native String blobToBase64(String source)/*-{
var xhr = new XMLHttpRequest();
xhr.open('GET', source, true);
xhr.responseType = 'blob';
xhr.onload = function(e) {
if (this.status == 200) {
var myBlob = this.response;
alert("Converted to Blob");
}
};
xhr.send();
}-*/;
但是,当传递 blob 源时,警告框不显示,因此它不起作用。而this.status 的响应是0
【问题讨论】:
标签: java javascript jquery gwt jsni