Facebook 的“赞"按钮破坏了 https/SSL [英] Facebook 'Like' button breaks https/SSL
问题描述
在我维护的电子商务网站上,我按照此处的说明添加了 Facebook 的赞"按钮:
On an e-commerce website I maintain, I added a Facebook 'Like' button per the instructions here:
http://developers.facebook.com/docs/reference/plugins/like
我正在使用 iframe 方法:
I am using the iframe method:
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fexample.com%2Fpage%2Fto%2Flike&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80"
scrolling="no" frameborder="0" style="border:none; overflow:hidden;
width:450px; height:80px;" allowTransparency="true">
</iframe>
它有效,但如果客户碰巧登录了她的帐户,她会收到臭名昭著的混合内容警告"
It works, but if a customer happens to be logged into her account, she gets the infamous "mixed content warning"
有没有一种方法可以使用相同的 Facebook 'Like' 按钮代码,但在 SSL 模式下不会插入非 https 内容?
Is there a way to use the same Facebook 'Like' button code but in a way that will not interject non-https content when in SSL mode?
推荐答案
您可以通过不具体说明传输协议来避免对支持 SSL 的域的 SSL 警告.例如使用 //
代替 http://
或 https://
.
You can avoid SSL warnings for domains that support SSL by not being specific about the transport protocol. e.g. instead of including http://
or https://
, use //
.
代替
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fexample.com%2Fpage%2Fto%2Flike&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
使用
<iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Fexample.com%2Fpage%2Fto%2Flike&layout=standard&show_faces=true&width=450&action=like&colorscheme=light&height=80" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
这篇关于Facebook 的“赞"按钮破坏了 https/SSL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!