Imgur images not showing up in JSFiddle

ⅰ亾dé卋堺 提交于 2019-12-10 17:00:30

问题


I was about to ask a question about a JSFiddle, and I noticed that the images (which I've got on Imgur) don't show up. If I load the image directly in the browser, and then reload the fiddle the picture shows up, but if you haven't already loaded the pictures they won't display. Is there a way I can fix this? Or do I just need to host the pictures on a different site?

Here's the link to the fiddle: http://jsfiddle.net/r4crr/3/

And here's a bit of dumb code from the fiddle that it appears is actually irrelevant.

<div id="makeJSFshowPics">
<img src="http://i.imgur.com/7ftvzYB.png" alt="High Interest"><img src="http://i.imgur.com/u8i9Coo.png" alt="Okay I guess"><img src="http://i.imgur.com/v66NbIR.png" alt="Do Not Want">   


回答1:


Opened up Chrome's network panel and noticed that those urls were getting 403 - Forbidden from imgur. Not sure why. So I opened the imgur url in a new tab, then went back to jsfiddle and hit run. Bingo, the image showed up. Had to do this for all of the images, which is not great. Looks like other people have run into this problem but there wasn't any solution to it.




回答2:


For whatever reason, imgur is blocking the images from jsfiddle (and jsbin). Perhaps there were abuses coming in, I am not sure as to the why. The images are blocked based on the referrer. It would be possible to implement a bypass where the images were proloaded in an iframe which spoofed the referrer. That seems a little over the top though. It would work for the same reason that you can see the images in the fiddle after you visit the imgur url for the image, because it is cached.



来源:https://stackoverflow.com/questions/15346109/imgur-images-not-showing-up-in-jsfiddle

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