Facebook Like Button renders 1000px*1000px after pressing Back on Browser on Chrome and blocks page content

时光毁灭记忆、已成空白 提交于 2019-12-04 06:11:04

I can confirm this is happening for myself as well across multiple sites.

Facebook is aware of the issue which may take some time to fix according to https://developers.facebook.com/x/bugs/663421210369743/

In the short-term, many other developers seems to be suggesting to target the iframe specifically through css (or timeout javascript call) to force the height back to about 20px.

When using css, ensure you use !important to override the style attribute that ends up on the iframe from facebook.

I know this is an old post but it's still happening.

Add this inline to the code facebook gives you:

data-height="30px" data-width="130px"

And this to the CSS

.fb-like { width: 130px !important; }

Of course, you can change the width to whatever you want.

So your code should look like this (where XX is replaced with your parameters):

<div class="fb-like" data-href="XX" data-send="XX" data-layout="XX" data-show-faces="XX" data-height="30px" data-width="130px">

This is only a temporary solution until it is fixed as the facebook button disappears after a minute or so.

Probably not the best solution out there but adding the following css could work for now:

.fb-like iframe { width: 500px!important; height: 50px!important; }

For me this is happening when the facebook like button is wrapped in "position relative" element with "z-index" higher then the content wrapper.

Check the position and the z-index of your elements.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!