URL.createObjectURL returns a blob with null prepended. Eg : Blob:null/12415-63

谁说胖子不能爱 提交于 2019-12-01 18:47:23

That's the origin, file system and sandboxed iframes(maybe others) have null as their origin. If you set up a local sever it should say http%3A//localhost, that's http://localhost url encoded

    var arrayBuffer = new ArrayBuffer(100);
	var uint8Array = new Uint8Array(arrayBuffer);
	for (var i = 0; i < 100; i++) {
		uint8Array[i] = i;
	}

	var blob = new Blob([uint8Array], { type: "image/png" });
	var blobVal = URL.createObjectURL(blob);
	$('div').html(blobVal);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div></div>

This one sais http%3A//fiddle.jshell.net
http://jsfiddle.net/thsn3ayp/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!