Angularjs - Firefox无法在新标签中打开blob网址

Liv*_*ree 5 firefox angularjs

我有以下代码在Chrome和IE中正常工作.用户点击一个锚标签,然后执行代码,然后在一个带有url blob的新标签中呈现pdf文件:http:// localhost:57389/5aee262a-8bc9-4943-b67f-7b76aeef4b99

vme.loadAttachment = function (attachment) {
    taskService.getAttachmentContent(attachment.Name)
        .then(function (response) {
            var file = new Blob([response], { type: attachment.Type });
            if (window.navigator && window.navigator.msSaveOrOpenBlob) {
                window.navigator.msSaveOrOpenBlob(file);
            }
            else {
                var objectUrl = URL.createObjectURL(file);
                window.open($sce.trustAsResourceUrl(objectUrl), _blank");
            }
       })
};
Run Code Online (Sandbox Code Playgroud)

但是在Firefox上,新选项卡已打开,但会立即关闭.知道是什么原因引起的吗?

LSe*_*rni 6

这件事今天发生在我身上.我有几个不同的VM快照,我用它来测试不同的"客户端",我有两个这样的PDF无法打开 - 浏览器短暂闪烁,PDF没有出现.

最后,它是一个广告拦截器(ABP).只是告诉它忽略网站域允许PDF正确显示.