How to move an iFrame with dynamic content set?
After the mode, the iFrame content disappeared.
To illustrate, I've create a jsfiddle:
<div id='source'>
<p> source </p>
<div id='wrapper'>
<iframe id='f'>
</iframe>
</div>
</div>
<div id='dest'>
<p> dest </p>
</div>
<button id='btnGo'> Go</button>
<script>
(function($) {
$('#f').contents().find('html').html("<strong>Hello</strong>");
$('#btnGo').click(function() {
$('#wrapper').appendTo($('#dest'));
});
})(jQuery);
</script>
Old question, which is actually not related to twitter:
I'm trying to move a twitter widget from one container to another.
However, when the widget moves, it's getting blank. Using any dom explorer, I can see that its internal iframe's body is empty.
How to workaround this?
A reproductible fiddle shows the behavior.
I'm trying to move the widget using jQuery.move:
$("#btnRepro").click(function() {
$("#wrapper").appendTo($("#right"));
});
The widget is produced using this snippet (generated on twitter website:
<div id='wrapper'>
<a class="twitter-timeline" href="https://twitter.com/hashtag/#dragnpoint" data-widget-id="709489444726968320">Chargement des tweets</a>
<script>
! function(d, s, id){var js, fjs = d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if (!d.getElementById(id)) {js = d.createElement(s);js.id = id;js.src = p + "://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js, fjs);}}(document, "script", "twitter-wjs");
</script>
</div>