Search code examples
javascripthtmlgoogle-plussocial-media

Google Plus button not showing: FireBug shows a "NetworkError: 404 not found"


I want to show a Google Plus (Google+) button on my website. On my page I have:

<g:plusone size="tall"></g:plusone>

As a script, below on the same page, I have:

<script type="text/javascript" language="javascript" src="/static/external/google/plusone.js">
        { lang: 'da' }
    </script>

I made sure the script is up to date, and even tried Googles CDN, but still no button is shown.

In FireBug, I can see I get the following error, which probably is the error:

"NetworkError: 404 Not Found - https://plus.google.com/_/apps-static/_/js/gapi/gcm_ppb,googleapis_client,plusone/rt=j/ver=tfhAJ-U7Vlc.da./sv=1/am=!brN6X75-Zu-IDRYPeA/d=1/cb=gapi.loaded0"

This is a problem both locally and online on my production site.

Does anyone have an idea on how to solve it?


Solution

  • You can use this code instead :

    <div class="g-plusone" data-annotation="inline" data-width="300"></div>
    

    Javascript :

    window.___gcfg = {lang: 'da'};
    
    (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);
    })();
    

    Result : http://jsfiddle.net/L3XR7/