Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6533441
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:07:33+00:00 2026-05-25T10:07:33+00:00

Google+ allows developers to utilize what they call an explicit render to display the

  • 0

Google+ allows developers to utilize what they call an “explicit render” to display the Google+ button only when a particular event takes place on the page (see: http://code.google.com/apis/+1button/#example-explicit-render). This is very helpful on pages where multiple buttons are required.

Twitter, however, renders a tweet button (using an iframe) in the place of each link on the page with the class “twitter-share-button”. This causes very slow page loads (even when I load Twitter’s widget.js asynchronously after the DOM is loaded.

Does anyone know of a way to mimic the Google+ explicit render for Tweet buttons, or a way to render a Tweet button only when a certain DOM event takes place (like mouseover)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T10:07:34+00:00Added an answer on May 25, 2026 at 10:07 am

    I finally found a way to do this. It’s not nearly as clean as the Google+ button, but here it is:

    First, make sure you have jQuery included in your document’s head:

    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    

    Then create a link that has the same URL as the eventual tweet button, along with an empty div where your button will be rendered:

    <a href="http://www.my-site-to-tweet-about.com" id="tlink"></a>
    <div id="tbutton"></div>
    

    At the bottom of your page, right above the /body tag, include the javascript from Twitter and the function that will render the button, as well as the listener that will activate the function when the desired event takes place:

    <script type="text/javascript">
    //async script, twitter button fashiolista.com style
        (function() {
        var s = document.createElement('SCRIPT');
        var c = document.getElementsByTagName('script')[0];
        s.type = 'text/javascript';
        s.defer = "defer";
        s.async = true;
        s.src = 'http://platform.twitter.com/widgets.js';
        c.parentNode.insertBefore(s, c);
        })();
    
    function renderTweetButton(tbutton,tlink){
        var href = $("#"+tlink).attr('href'),
            $target = $("#"+tbutton),
            qstring = $.param({ url: href, count: "vertical" }),
            toinsert = '<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?'+qstring+'" style="width:57px; height:70px;"></iframe>';
        $target.html(toinsert);
    }
    
    $("#hoverlink").mouseenter(function() {
        renderTweetButton("tbutton","tlink");
    });
    </script>
    

    Lastly, add a link to your page somewhere that will activate the function above based on some event:

    <a href="#" id="hoverlink">Hover here to render a tweet button to div#tbutton.</a>
    

    That’s it.

    If you want the entire test HTML page to see how I’ve got it working, see here:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>jQuery Twitter Button Render Test</title>
    
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
    
    </head>
    
    <body>
    
    <a href="http://www.my-site-to-tweet-about.com" id="tlink"></a>
    <div id="tbutton"></div>
    
    <a href="#" id="hoverlink">Hover here to render a tweet button to div#tbutton.</a>
    
    
    <script type="text/javascript">
    //async script, twitter button fashiolista.com style
        (function() {
        var s = document.createElement('SCRIPT');
        var c = document.getElementsByTagName('script')[0];
        s.type = 'text/javascript';
        s.defer = "defer";
        s.async = true;
        s.src = 'http://platform.twitter.com/widgets.js';
        c.parentNode.insertBefore(s, c);
        })();
    
    function renderTweetButton(tbutton,tlink){
        var href = $("#"+tlink).attr('href'),
            $target = $("#"+tbutton),
            qstring = $.param({ url: href, count: "vertical" }),
            toinsert = '<iframe allowtransparency="true" frameborder="0" scrolling="no" src="http://platform.twitter.com/widgets/tweet_button.html?'+qstring+'" style="width:57px; height:70px;"></iframe>';
        $target.html(toinsert);
    }
    
    $("#hoverlink").mouseenter(function() {
        renderTweetButton("tbutton","tlink");
    });
    
    </script>
    
    </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

According to this Wikipedia article on Google App Engine : Developers have read-only access
I've been trying to print out Google Calendars but they only print for letter
How would I go about creating a Google map that allows the user to
I am writing a Google Wave Robot that allows users to manage a wave.
We've been using Trac for a while now for our developers only. However we
This function is wired up to the click event of a button: function BlahBlahBlahWCFXML()
Google Wave allows two or more participants to speak privately within a wave. When
Google maps is an impressive display of what you can do with JavaScript and
(EDIT: This question is now outdated for my particular issue, as Google Code supports
The web version of Google maps allows the developer to show a map legend

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.