SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Nov 2010
    Posts
    14
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Loading AddThis / Facebook like button / TwitterCounter

    Hello,

    I am working on a site that loads 3 external resources.

    -AddThis button

    Code:
    <!-- AddThis Button BEGIN -->
    <div class="addthis">
    <div class="addthis_toolbox addthis_default_style">
    <a href="http://www.addthis.com/bookmark.php?v=250&amp;username=espett" class="addthis_button_compact">Share</a>
    <span class="addthis_separator">|</span>
    <a class="addthis_button_facebook" style="cursor:pointer"></a>
    <a class="addthis_button_twitter" style="cursor:pointer"></a>
    <a class="addthis_button_email" style="cursor:pointer"></a>
    <a class="addthis_button_favorites" style="cursor:pointer"></a>
    </div>
    <script type="text/javascript">var addthis_config = {"data_track_clickback":true};</script>
    <script type="text/javascript"  src="http://s7.addthis.com/js/250/addthis_widget.js#username=espett"></script>
    <!-- AddThis Button END -->
    -Facebook follow button (not javascript)

    Code:
    <iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwww.facebook.com%2F%23%21%2Fpages%2FFishListcom%2F130266186986815%3Fref%3Dsgm&amp;layout=button_count&amp;show_faces=false&amp;width=75&amp;action=recommend&amp;font=arial&amp;colorscheme=light&amp;height=21" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:126px; height:21px;" allowTransparency="true"></iframe>
    -TwitterCounter button

    Code:
    <!-- Start of TwitterCounter Code -->
    <script type="text/javascript" language="javascript" src="http://twittercounter.com/widget/index.php?username=FishList"></script>
    <!-- End of TwitterCounter Code -->


    These scripts always hold up the rest of the page from loading. Is there anyway to defer them from loading or load them asynchronously?

    Thanks!
    Last edited by HAWK; Aug 16, 2011 at 19:35. Reason: Link removed at OP's request

  2. #2
    Under Construction silver trophybronze trophy AussieJohn's Avatar
    Join Date
    Sep 2005
    Location
    Sydney, Australia
    Posts
    776
    Mentioned
    11 Post(s)
    Tagged
    0 Thread(s)
    Hiya :-)

    (forgive the brevity, at work atm.)

    - Addthis can be loaded Asynchronously http://www.addthis.com/help/optimizing-addthis

    - You could use the FB opengraph like button that gets inserted with JS, which will help speed up loading a bit.

    - You might be able to load the twitter counter after the DOM has loaded. Perhaps something like LAB JS will be useful.
    var details = {
    . . web: "afterlight.com.au",
    . . photos: "jvdl.id.au",
    . . psa: "usethelatestversion.com"
    }


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •