I was playing with making a custom CheckboxSelectMultiple widget for my form. I added an img tag to the widget with the src pointing to another website that contained the image.
I receive broken images when I display my form. The source page seems correct when I view it:
<li><label for="开发者_运维百科id_display_0"><input type="checkbox" name="display" value="<data" id="id_display_0" /> <img src="www.fakeplace.com/s.jpg"/></label></li>
But when I click on the link in the img src, it complains about a 404:
Request URL: http://127.0.0.1:8000/browse/www.fakeplace.com/s.jpg
. I think it has to do with how static media works, but I am unsure how to work around it (I don't want to store the images on my local machine right now).
Replace:
<img src="www.fakeplace.com/s.jpg"/>
with:
<img src="http://www.fakeplace.com/s.jpg"/>
Otherwise, to the browser it looks like a relative URL.
As steve and prashanth said, prefix http://
Also I recommend putting an alt tag, even if it is blank, for accessibility and conformity reasons, eg
<img src="http://www.fakeplace.com/s.jpg" alt=""/>
精彩评论