Welcome to WebmasterWorld Guest from 54.196.244.45

Forum Moderators: not2easy

Message Too Old, No Replies

how to avoid facebook 'like' button turning gray

     
10:51 pm on Mar 8, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:July 8, 2007
posts:147
votes: 0


Facebook is blocked in some offices and countries. If a website has a 'Like' button, it will turn gray (page not found in the iframe) to those viewers and it makes the page look broken.

Do you have any idea (maybe CSS method) to hide this gray area? When <iframe> is not loaded, it will show some other thing (like white color background) instead of showing a gray "dead" page?

The code for like button is like this:
<iframe src="http://www.facebook.com/plugins/like.php?href=your URL;layout=standard&amp;show_faces=false&amp;width=40&amp;action=like&amp;colorscheme=light&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:50px; height:35px;" allowTransparency="true">
</iframe>
3:13 am on Mar 9, 2011 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Aug 1, 2003
posts:815
votes: 0


Before you begin, you might want to make real sure this isn't contrary to any Facebook terms of service.

One way you could tackle this is to use JavaScript to test browser access to Facebook. If the browser doesn't have access, then don't display the iframe. Here's a page explaining the JavaScript techniques for making requests.

[eloquentjavascript.net ]

One tricky part to be aware of is that different organizations block in different ways. Some might just let the request time out, while others return a response telling the users that site is forbidden.
8:14 am on Mar 23, 2011 (gmt 0)

Junior Member

5+ Year Member

joined:July 8, 2007
posts:147
votes: 0


I'm not familiar with Javascript at all and try to put those things together part by part. Thanks timster for the hints.