I get a 403 error when inserting an image tag into my website

ε祈祈猫儿з 提交于 2019-12-12 03:44:41

问题


I'm dynamically inserting the following tag into my webpage:

<img src="http://ia.media-imdb.com/images/M/MV5BMTgxMDczMTA5N15BMl5BanBnXkFtZTcwMzk1MzMzMw@@._V1_SX300.jpg">

When I go to the linked address, the image shows up fine. When I try to load it on my development server at http://localhost:8000, it shows up fine. But when I try to load it on my production server at http://example.org, it doesn't show up, and the console shows "Failed to load resource: the server responded with a status of 403 (Forbidden)"

Here's the javascript that inserts the tag:

$("#sb-photo").html('<img src="' + movie.Poster + '">');

UPDATE: This older question seems to address the same problem:

Getting 403 forbidden when dynamically loading images in AngularJS

However, the accepted answer doesn't actually work, at least not anymore.

Also, I just realized that the first time I insert an image, it works. But following times I get the 403 error.

来源:https://stackoverflow.com/questions/37231735/i-get-a-403-error-when-inserting-an-image-tag-into-my-website

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!