0
votes

The google plus badge sometimes it render okay with no errors, sometimes it doesn't render and give this error in the console :

TypeError: a is undefined
...pi.auth,e={client_id:c,session_state:b};a.checkSessionState(e,function(b){var c=.

My code is :

< div class="g-page" data-href="https://plus.google.com/+google" data-theme="dark" data-showtagline="true" data-showcoverphoto="true" data-rel="publisher" >

<!-- Place this tag after the last widget tag. --><script type="text/javascript">
window.___gcfg = { 
    lang: 'de'
};

// just put this in here
document.getElementsByClassName('g-page')[0].setAttribute('data-width', document.getElementById('google-badge').clientWidth);

(function () {
    var po = document.createElement('script');
    po.type = 'text/javascript';
    po.async = true;
    po.src = 'https://apis.google.com/js/platform.js';
    var s = document.getElementsByTagName('script')[0];
    s.parentNode.insertBefore(po, s);
})();
</script>

EDIT: the a is defined in the google api here : https://apis.google.com/js/platform.js

1
Is there more code somewhere? I'm not seeing where a is being defined or what it's supposed to be. - jonmrich
likely you have a timing issue. is the DOM ready for your calls? likely not - Zig Mandel

1 Answers

0
votes

I have the same problem. I think google badge library somehow conflicts with other javascript libraries like AngularJS.