Note that there are some explanatory texts on larger screens.

plurals
  1. POIssue Loading Google +1 Widget Asynchronously
    primarykey
    data
    text
    <p>I have a few widgets on the site I'm developing and I load them all asynchronously from a javascript file so it does not hold up the DOM from finishing.</p> <p>For instance, I do this with the Digg and Buzz widgets and it works fine:</p> <pre><code>// Buzz Share function buzzShare() { $jQ('.sharebox').append('&lt;div class="widget"&gt;&lt;a title="Post to Google Buzz" class="google-buzz-button" href="http://www.google.com/buzz/post" data-button-style="normal-count"&gt;&lt;/a&gt;&lt;/div&gt;'); $jQ.getScript('http://www.google.com/buzz/api/button.js'); } // Digg Share function diggShare() { $jQ('.sharebox').append('&lt;div class="widget"&gt;&lt;a class="DiggThisButton DiggMedium"&gt;&lt;/a&gt;&lt;/div&gt;'); $jQ.getScript('http://widgets.digg.com/buttons.js'); } </code></pre> <p>When it comes to the new Google +1 widget, the same logic does not work:</p> <pre><code>// PlusOne Share function plusOneShare() { $jQ.getScript('http://apis.google.com/js/plusone.js'); $jQ('.sharebox').append('&lt;div class="widget"&gt;&lt;div class="g-plusone" data-size="tall" data-count="true"&gt;&lt;/div&gt;&lt;/div&gt;'); } </code></pre> <p>I tried using both the HTML5 tag and <code>&lt;g:plusone&gt;&lt;/g:plusone&gt;</code>. Neither work.</p> <p>Here is the documentation for the just-launched service: <a href="http://code.google.com/apis/+1button/" rel="nofollow">http://code.google.com/apis/+1button/</a></p> <p>I also noticed you can do the following if embedding the script directly into the HTML.</p> <pre><code> &lt;script type="text/javascript" src="https://apis.google.com/js/plusone.js"&gt; {"parsetags": "explicit"} &lt;/script&gt; </code></pre> <p>Is there a way to use the <code>{"parsetags": "explicit"}</code> parameters with jQuery <code>.getScript</code>?</p> <p>P.S. I also tried switching around the first and second lines within the plusOneShare function, that didn't work either.</p> <p>Thanks!</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload