通过缓存的 Facebook 小部件成为 Facebook 粉丝

发布于 2024-11-02 16:21:57 字数 367 浏览 1 评论 0原文

我在博客上使用官方粉丝盒小部件已经有一段时间了,想用加载更少内容的缓存版本的小部件替换它。

小部件(用于 WordPress)工作得很好(http://www.electriceasel.com/plugins/plugin-facebook-fan-box-cache),但是有一件事让我烦恼。

“我喜欢”按钮只是链接到 Facebook 粉丝页面,因此用户必须再次点击“成为粉丝”,这是没有意义的,因为用户会期望在第一次点击后就已经成为粉丝了。

我正在寻找的是这两个问题的解决方案:

1.)找到一种方法让用户直接成为缓存插件版本的粉丝

2.)减少小部件的所有垃圾Facebook负载。它使我的页面加载时间增加了两秒,这是不可接受的。

I've been using the official fan box widget for a while on my blog and wanted to replace it with a cached version of the widget which loads much fewer content.

The widget (for Wordpress) works pretty well (http://www.electriceasel.com/plugins/plugin-facebook-fan-box-cache) however one thing bugs me.

The "I like"-button just links to the Facebook-fanpage so the user would've to click again on "become a fan" which makes no sense since the user would expect to already be a fan after the first click.

What I'm looking for are solutions for either of these two problems:

1.) Find a way for users to become a fan with the cached plugin-version directly

2.) Reduce all the crap Facebook loads for the widget. It adds two seconds to my pages loadtime which isn't acceptable.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

冷血 2024-11-09 16:21:57

作为该插件的作者,我需要说,这可能是最需要的功能。我正在研究这个问题的解决方案,但我还必须注意,该插件的目的是删除所有外部 JS 文件以加快加载速度。我正在研究一个非常小的 JS 脚本,我可以利用它来按要求工作,但还没有做到这一点。请参阅您链接到的博客文章以获取进一步更新。

As the author of the plugin, I need to say, this is probably the MOST requested feature. I'm working on a solution to this, but I also must note that the purpose of the plugin was to remove all external JS files to speed up loading. I'm looking into a very small JS script that I could utilize to get this working as requested, but haven't been able to to this point. Reference the blog post you linked to for further updates.

情徒 2024-11-09 16:21:57

您可能不想缓存 facebook 代码,因为您无法知道它何时被更改/更新。此代码将加载脚本而不阻塞页面。您的“点赞”按钮可能需要 2 秒钟才会显示,但这会防止您描述的加载缓慢。

  <div id="fb-root"></div>
  <script>
  (function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js#xfbml=1';
    document.getElementById('fb-root').appendChild(e);
  }());
</script>

you probably don't want to cache the facebook code as you'd have no way to know when it was changed/updated. This code will load the script without blocking the page. It may take 2 seconds for your like buttons to show up but it will prevent the slow loading you describe.

  <div id="fb-root"></div>
  <script>
  (function() {
    var e = document.createElement('script'); e.async = true;
    e.src = document.location.protocol +
      '//connect.facebook.net/en_US/all.js#xfbml=1';
    document.getElementById('fb-root').appendChild(e);
  }());
</script>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文