43

我正在尝试向我的网站添加一个 Google Plus 按钮,并不断收到 JavaScript 安全警告,尽管我在 Chrome 上使用的是 Google 推荐的代码。

我已经使用直接从 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.

谷歌网站管理员推荐的代码根本不安全吗?还是我做错了什么?

4

1 回答 1

30

这是社交插件抛出的常见警告。Twitter 和 Facebook 插件通常也会发出此警告。您可以放心地忽略它。

于 2011-12-06T16:00:25.653 回答