谷歌加徽章有时会渲染没有错误,有时它不会渲染并在控制台中出现此错误:
TypeError: a is undefined
...pi.auth,e={client_id:c,session_state:b};a.checkSessionState(e,function(b){var c=.
我的代码是:
< 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>
编辑: a在google api中定义:https://apis.google.com/js/platform.js
答案 0 :(得分:0)
我有同样的问题。我认为谷歌徽章库与AngularJS等其他JavaScript库存在冲突。