Google+按钮iframe错误
Google+ button iframe error
我正在制作一个生成器,它可以帮助在一个屋檐下创建社交按钮。我能够为Facebook创建生成器。Twitter,但是Google+按钮一开始就有问题。
我搜索了很多,但找不到一个合适的答案"拒绝显示....。'X-Frame-Options'到'SAMEORIGIN'".
Refused to display 'https://apis.google.com/se/0/_/+1/fastbutton?usegapi=1&action=1&size=medium…d=I0_1438276469698&parent=http%3A%2F%2Flocalhost&pfname=&rpctoken=13424874' in a frame because it set 'X-Frame-Options' to 'SAMEORIGIN'.
是的,我在本地测试,但我甚至在一个网站上尝试在线,但它仍然抛出这个错误。
简单代码
jQuery( document ).ready( function( $ ) {
// GooglePlus script
(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);
})();
// Add button markup
$( '#googleplus-container' ).html( '<div id="gp" class="g-plusone" data-action="1" data-size="medium" data-annotation="inline" data-width=""></div>' );
// Initialize button
if( typeof gapi !== 'undefined' ){
gapi.plusone.go( '#googleplus-container' );
}
});
这个问题有什么直接的解决办法吗?
一旦这个问题解决了,我将根据用户输入动态地改变按钮和它的参数,然后将重新初始化按钮,以便可以实时看到更改。
是否有其他的方法,我可以遵循像直接添加iframe?
谢谢!
从g-plusone
div中删除data-action="1"
。这是一个不支持的属性,并且会以某种方式改变行为。
相关文章:
- 动态创建的iframe中的window.onerror在lne 0处给出脚本错误
- 可以'iframe的父窗口中发生捕获错误
- 尝试从我的 chrome 扩展程序访问 gmail 中的 iframe 时出现未定义的错误,但不是从开发者控制台访问
- 未捕获的语法错误:使用 iFrame 时出现意外的令牌 }
- 如何捕获 iframe 内的 img 标记返回的 404(未找到)错误
- 为什么当我尝试为iframe-src属性构建URL时,AngularJS会抛出错误
- 当我尝试使用jquery获取iframe的内容时,我得到了错误.请帮我解决
- 使用 iframe 时的 JavaScript 错误
- TypeError: e.fixers 是动态加载的 iframe 上无前缀的未定义错误
- 通过 IFrame 更新文件时的错误处理
- 如何捕获 iframe 加载错误
- Youtube IFrame Internet Explorer上的Fancybox错误
- 水星编辑器 0.9 - 内容 iFrame 位于编辑器控件后面,高度错误
- 关闭包含YouTube电影的Fancybox-iframe时出现IE JS错误
- Ajax Iframe 创建(Spotify widget):x 帧错误
- 来源较少的iframe错误火狐
- 刷新 iframe 错误
- 如果在小型设备上,请将 iframe 替换为错误文本
- 如何修复处理 iframe 的此错误
- 用Angular JS加载iframe src-错误