IE10 use BLOB url in iframe
IE10 use BLOB url in iframe
我正在创建一个BLOB url并将此url分配给iframe的位置。在Firefox和Chrome中,这工作没有问题,在IE10中,BLOB url的内容不显示在iframe中。在IE10调试器中,我可以看到,创建BLOB url没有问题。
var test =
{
init: function()
{
var parts = ["<html><body>test</body></html>"];
var myBlob = new Blob(parts, {"type":"text'html"});
var blobUrl = URL.createObjectURL(myBlob);
document.getElementById("test").contentWindow.location = blobUrl;
}
}
window.addEventListener("DOMContentLoaded", test.init, true);
你知道怎么了吗?
请尝试对每个BlobBuilder和Blob构造函数使用特征检测。
if (typeof Blob !== "undefined") {
// use the Blob constructor
} else if (window.MSBlobBuilder || window.WebKitBlobBuilder || window.MozBlobBuilder) {
// use the supported vendor-prefixed BlobBuilder
} else {
// neither Blob constructor nor BlobBuilder is supported
}
另一个技巧是使用URL.createObjectURL(blob)
相对于window
:
var blobUrl = window.URL.createObjectURL(myBlob);
IE在这一点上是明智的!也许这有帮助!
相关文章:
- 防止Iframe窗体在新窗口中打开
- 将样式表插入iframe
- Node.js's Buffer.writeFloatBE in Javascript
- 在Twitter上用ie9中的空白src访问iframe的contentWindow
- Setting default onclick behavior for <img> tag in gene
- 使用jQuery从原始页面内容创建iframe
- Highslide(iframe的侦听器)
- iframe正在添加标签,需要删除它们
- 通过javascript/html访问twitter共享iframe
- 如何在Facebook上的iframe应用程序中使后退按钮返回到上一页
- 如何使用Angular动态添加iframe-src
- Content-Security-Policy for webapp in iframe
- IFrame for IOS in JS
- iframe Fade Out/In with jQuery
- AngularJs ng-src in Iframe
- windows .location.href in iframe在FireFox中不起作用
- Facebook iframe page_fan in javascript
- iframe to stackoverflow.com in jsbin
- cannot load file in iframe getting error: Can't interpol
- IE10 use BLOB url in iframe