Twitter bootstrap modal doesn’t load external urls inside modal.
Sample Code : jsFiddle
<a data-toggle="modal" class="btn" href="http://stackoverflow.com" data-target="#myModal">click me</a>
<div class="modal hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h3 id="myModalLabel">Modal header</h3>
</div>
<div class="modal-body">
</div>
</div>
This doesn’t work because you are violating the same origin policy restriction that prevents you from sending cross domain AJAX requests which is what bootstrap is using here. So one possibility is to load the external content into an
<iframe>:Be warned though that some sites (such as google, stackoverflow, facebook, …) cannot be loaded into an iframe. They are setting the
X-Frame-Optionsresponse HTTP header toSAMEORIGINand also check if they are loaded inside aniframe.You can see it in action in this fiddle: http://jsfiddle.net/f2Fcd/