Twitter embed (with wordpress) and load?

I want to know when a tweet is loaded.
I have this kind of post http://pego-design.com/remarky-brisi/media-twitter-embeds/ or here http://en.support.wordpress.com/twitter/twitter-embeds/
and would like to know the height of the strange iframe create by this code :

<div class="entry-content">
<blockquote class="twitter-tweet" width="550"><p>Really cool to read through and find so much awesomeness added to WordPress 3.6 while I was gone. I should take three weeks off more often.</p>
<p>&mdash; Andrew Nacin (@nacin) <a href="https://twitter.com/nacin/status/319508408669708289">April 3, 2013</a></p></blockquote>
<p><script async src="//platform.twitter.com/widgets.js" charset="utf-8"></script></p>

ugly with js demo : http://jsfiddle.net/qWHc5/2/

Read More

If you check this demo, you can see first and final size of the iframe (93,213,213,213… or 93,93,93,213,213…), I need to know how to get the last value without an ugly solution.

I try this How can I detect whether an iframe is loaded? but doesn’t work…

UPDATE : I found this version of widgets.js https://gist.github.com/johan/4479186 with callbacks I don’t knwo how to use, like this window.twttr.tfw.callbacks.cb0.

Related posts

Leave a Reply

2 comments

  1. WordPress uses oEmbed to include twitter among others.
    You can find the code that does this at wp-includes/class-oembed.php

    To influence it use:

    function so_17151843_embed ( $provider, $url, $args ) {
      // check $provider if it is twitter
      // change url values to what you want
      $url = add_query_arg( 'maxheight', $url )
    
      return $url;
    }
    add_filter( 'oembed_fetch_url', 'so_17151843_embed' );
    

    You can place this in you funtions.php.
    This should help you on your way.

  2. Here’s the correct way to check when Twitter is ready:

    if (window.twttr !== undefined) {
        window.twttr.ready(function(){
            console.log("Twitter ready!");
        });
    };
    

    Late answer but hope this helps future users!