Getting 403 forbidden when dynamically loading images in AngularJS

前端 未结 1 1107
予麋鹿
予麋鹿 2020-12-22 04:44

I am loading json data from my api that contains urls to images outside of my domain. I\'ve done this in the past, not with Angular, and I\'ve never seen this problem...

相关标签:
1条回答
  • 2020-12-22 05:20

    It seems that imdb is checking the referer so other parties are not allowed to embeded their images directly on their website. If you try with images from other domains, it works: http://jsfiddle.net/PZJKZ/2/

    var app = angular.module('app', []);
    
    function HomeController($scope) {
        $scope.search = function() {
            $scope.movies = [ 
                { Title: 'The Matrix', Poster: 'http://dartr.com/wp-content/uploads/2011/10/javascript-logo.png' },
                { Title: 'The Matrix Reloaded', Poster: 'http://wpmu.org/wp-content/uploads/2010/04/jquery-logo1.png' }
            ];
        };
    }
    
    0 讨论(0)
提交回复
热议问题