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

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

c# - Get rid of xmlns attribute when adding node to existing xml -