Duplicate download of social code

Community Forums Forums General Discussion Duplicate download of social code

This topic is: not resolved

Tagged: ,

This topic contains 3 replies, has 2 voices, and was last updated by  SoZo 1 year, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4666

    Antonios
    Participant
    Post count: 10

    I want to have social sharing buttons at the top and bottom of my pages. However, I’m seeing duplicate downloads of some elements.

    http://www.webpagetest.org/result/121212_8Y_4HX/1/details/

    functions.php contains:

     

    /** add social sharing buttons **/
    add_action( ‘genesis_before_post_content’, ‘child_social_media_icons’, 5 );
    add_action( ‘genesis_after_post_content’, ‘child_social_media_icons’, 5 );
    /**
    * Social Media Icons
    *
    * @author Greg Rickaby
    * @since 1.0.0
    */
    function child_social_media_icons() {
    if ( is_single() || is_page()) { ?>

    <div id=”social-media-icons”>
    <div>
    <div data-send=”false” data-layout=”button_count” data-width=”100″ data-show-faces=”false”></div>
    <div id=”fb-root”></div>
    <script>
    (function(d, s, id) {
    var js, fjs = d.getElementsByTagName(s)[0];
    if (d.getElementById(id)) return;
    js = d.createElement(s); js.id = id;
    js.src = “//connect.facebook.net/en_US/all.js#xfbml=1&appId=myappidredacted”;
    fjs.parentNode.insertBefore(js, fjs);
    }(document, ‘script’, ‘facebook-jssdk’));
    </script>
    </div>

    <div>
    <a href=”https://twitter.com/share” data-url=”” data-text=”” data-via=”FueltheBodyWell”>Tweet</a>
    <script>
    !function(d,s,id) {
    var js,fjs=d.getElementsByTagName(s)[0];
    if(!d.getElementById(id)) {
    js=d.createElement(s);
    js.id=id;js.src=”//platform.twitter.com/widgets.js”;
    fjs.parentNode.insertBefore(js,fjs);}
    }(document,”script”,”twitter-wjs”);
    </script>
    </div>

    <div>
    <g:plusone size=”medium” href=”“></g:plusone>
    <script type=”text/javascript”>
    (function() {
    var po = document.createElement(‘script’); po.type = ‘text/javascript’; po.async = true;
    po.src = ‘https://apis.google.com/js/plusone.js’;
    var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(po, s);
    })();
    </script>
    </div>

     


    • This topic was modified 1 year, 8 months ago by  Antonios.
    • This topic was modified 1 year, 8 months ago by  Antonios. Reason: remove app id
    • This topic was modified 1 year, 8 months ago by  Antonios.
    • This topic was modified 1 year, 8 months ago by  Antonios. Reason: remove app id
    #16283

    SoZo
    Moderator
    Post count: 1573

    What do you mean by duplicate downloads?


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    #16519

    Antonios
    Participant
    Post count: 10

    If you look at the webpagetest.rog results you items related to the buttons downloaded twice

    for example:

    http://platform.twitter.com/widgets/tweet_button.1354761327.html

    is part of the twitter button and it is downloaded twice where I have two identical tweet buttons above the post and below the post.

    it seems like me there should be a way to have elements download only once no matter how many times they are loaded on the page.   Any ideas?


    #16650

    SoZo
    Moderator
    Post count: 1573

    No, your loading them twice and they aren’t local so they are going to download twice.


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.