I am trying to open a pdf file that i call from the server, i receive the file in the format of an arraybuffer. I tried many ways to open the pdf file in a new tab using $window.open and converting the file to other forms. Before you suggest downloading, it works but I want to open it in a new tab and it being safe to view as a popup.
The pdf opens with this url after converting it to a blob: "blob: http://console:8012/3c8b129d-3544-4f7e-a606-cf4b5eb6e1f3 " and my problem is that it is unsafe because it starts with a blob: and chrome marks it as unsafe.
Anybody got a clue how to fix this ? Thanks
在 angular 应用程序的配置块中注入$compileProvider
并添加以下行:
$compileProvider.aHrefSanitizationWhitelist(/^\s*(blob):/);
The default sanitization white lists for AngularJS v1.6 are 1 :
var aHrefSanitizationWhitelist = /^\s*(https?|ftp|mailto|tel|file):/,
imgSrcSanitizationWhitelist = /^\s*((https?|ftp|file|blob):|data:image\/)/;
Use the $compileProvider.aHrefSanitizationWhitelist method to add blob
to its white list.
app.config(function($compileProvider) {
var hrefWhiteList = /^\s*(https?|ftp|mailto|tel|file|blob):/;
$compileProvider.aHrefSanitizationWhitelist(hrefWhiteList);
});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.