43

Chrome で Google の推奨コードを使用しているにもかかわらず、サイトに Google Plus ボタンを追加しようとしていますが、JavaScript の安全性に関する警告が引き続き表示されます。

Google ウェブマスターの推奨コードから直接コピーしたコードでエラーを再現しました。他の追加はありません。

<html itemscope itemtype="http://schema.org/">
<head>
<meta itemprop="name" content="Title">
<meta itemprop="description" content="Description">
</head>
<body>
<g:plusone annotation="inline"></g:plusone>
<script type="text/javascript">
  (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);
  })();
</script>
</body>

これを Chrome (Mac では 15) にロードすると、開発者コンソールに次の警告が表示されます。

Unsafe JavaScript attempt to access frame with URL http://mydomain.com/ 
from frame with URL https://plusone.google.com/_/+1/fastbutton?url=http%3A%2F%2Fmydomain.com%2F&size=standard&count=true&annotation=inline&hl=en-US&jsh=m%3B%2F_%2Fapps-static%2F_%2Fjs%2Fwidget%2F__features__%2Frt%3Dj%2Fver%3Dt6mt7PFQYRQ.en_GB.%2Fsv%3D1%2Fam%3D!agWx4Vf_ACSIFA91ZQ%2Fd%3D1%2F#id=I1_1323174311773&parent=http%3A%2F%2Fmydomain.com&rpctoken=352111652&_methods=onPlusOne%2C_ready%2C_close%2C_open%2C_resizeMe. 
Domains, protocols and ports must match.

Google ウェブマスターが推奨するコードは単に安全ではないのでしょうか? それとも私は何か間違ったことをしましたか?

4

1 に答える 1

30

これは、ソーシャル プラグインによってスローされる一般的な警告です。Twitter および Facebook プラグインも通常、この警告をスローします。無視しても問題ありません。

于 2011-12-06T16:00:25.653 に答える