的谷歌加上徽章有時呈現還好沒有錯誤,有時不會呈現並在控制檯給這個錯誤:谷歌,加上徽章類型錯誤:一個是不確定
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>
編輯: 的一個在谷歌API定義如下:https://apis.google.com/js/platform.js
有沒有更多的代碼?我沒有看到'a'在哪裏被定義或者它應該是什麼。 – jonmrich
它在https://apis.google.com/js/platform.js – volkovmqx
可能是您的計時問題。 DOM準備好了嗎?可能不是 –