简体   繁体   English

访问控制允许来源

[英]Access-Control-Allow-Origin

I'm currently programming in jhispter(angularJS-spring), i have a problem, Implement a PDF viewer into the app.This one-> https://github.com/legalthings/angular-pdfjs-viewer 我目前正在用jhispter(angularJS-spring)进行编程,我有一个问题,在应用程序中实现PDF查看器。这个-> https://github.com/legalthings/angular-pdfjs-viewer

This is my error, im trying to read a pdf of antoher domain 这是我的错误,我试图读取其他域的pdf

Try using the $sce but that doesnt work 尝试使用$ sce,但这不起作用

My controller function : { 我的控制器功能:{

function ViewerCustomController($scope,$sce) {
    var vm = this;
    var trustPDF = $sce.trustAsResourceUrl('http://www.pdf995.com/samples/pdf.pdf');
    $scope.pdf =  {
        src: trustPDF,
    }

} }

If you know how i can configure to jhipster to CORS or give the permission Access-Control-Allow-Origin let me know plz, thank you. 如果您知道如何配置Jhipster到CORS或授予Access-Control-Allow-Origin权限,请让我知道plz,谢谢。

The request was prevented by your browser. 您的浏览器阻止了该请求。 So you should download the resource to your server, or force the target server www.pdf995.com to add a response header Access-Control-Allow-Origin . 因此,您应该将资源下载到服务器上,或强制目标服务器www.pdf995.com添加响应标头Access-Control-Allow-Origin

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM