javascript - Image src outputs garbled text in Bootstrap Modal -
here code snippet:
<a data-toggle="modal" class="comic-link" href="//files.explosm.net/comics/dave/adblocker2.png" data-target="#comicmodal"> <div class="thumb-home thumbnail"> <img id="comic" src="//files.explosm.net/comics/dave/adblocker2.png"> </div> </a>
this javascript:
$('a.comic-link').on('click touchstart', function() { var url = $(this).attr('href'); $(".comic-modal .modal-body").html('<img src="' + url + '"/>'); });
the images appear on webpage if click on link instead of images garbled text appears inside modal. there no errors in console. please let me know if need provide more details.
update
it happens explosm comics , not dilbert.
does adding http:
in front of url solve problem? in environment might not handling protocol-relative url properly.
Comments
Post a Comment