Chrome and IE windows load?

Why google plus button ain’t loading on chrome and ie here?

<!-- Lazy Share Buttons Start -->

<script type="text/javascript">
$(window).load(function () {
        loadSocial();
    });

function loadSocial() {

    //Twitter
    if (typeof (twttr) != 'undefined') {
        twttr.widgets.load();
    } else {
        $.getScript('http://platform.twitter.com/widgets.js');
    }

    //Facebook
    if (typeof (FB) != 'undefined') {
        FB.init({ status: true, cookie: true, xfbml: true });
    } else {
        $.getScript("http://connect.facebook.net/en_US/all.js#xfbml=1", function () {
            FB.init({ status: true, cookie: true, xfbml: true });
        });
    }

    //Google - Note that the google button will not show if you are opening the page from disk - it needs to be http(s)
    if (typeof (gapi) != 'undefined') {
        $(".g-plusone").each(function () {
            gapi.plusone.render($(this).get(0));
        });
    } else {
        $.getScript('https://apis.google.com/js/plusone.js');
    }
}

</script>

<!-- Lazy Share Buttons End -->

What does the HTML you’re applying it to look like?

It looks like if the google plus API is not present, you’re loading it using AJAX, but then never actually render the button. So you’d need to put that bit into the success callback of $.getScript() as well, like

$.getScript('https://apis.google.com/js/plusone.js', function() {
   $(".g-plusone").each(function () {
       gapi.plusone.render(this);
   });
});

I’d suggest to load those scripts synchronously though using regular script tags; otherwise you can’t ensure that those scripts have actually been evaluated when the success function gets called.

Awesome that really works your are awesome buddy thanks so much.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.