jpmaster
jpmaster

Reputation: 77

Iframe error using Twitter Bootstrap

I have the following error:

<a href="http://facebook.com/share.php?...." class="class">Click me</a>

<div class="modal hide" id="jpmodal">
 <div class="modal-header">
    <button class="close" data-dismiss="modal">×</button>
    <h3>Modal header</h3>
  </div>
    <div class="modal-body">
        <div id="loadframe">

        </div>
    </div>
</div>

JQuery:

$('a.class').on('click', function(e){
   e.preventDefault();
   var url = $(this).attr('href');
   $("#loadframe").html('<iframe width="300" height="200" frameborder="0" scrolling="no" allowtransparency="true" src="'+url+'"></iframe>');

   $('#jpmodal').modal('toggle');

});

The iframe is blank.

Chrome console returns me a blank page

Upvotes: 2

Views: 1566

Answers (1)

codeandcloud
codeandcloud

Reputation: 55200

You cannot load http://facebook.com/share.php?... in an iframe. Facebook blocks it by design to prevent clickjacking.

Using Send Button - Facebook Plugin is a much better option even though it does not support your purpose fully.

Upvotes: 1

Related Questions