Enable compression on facebook sdk served files to optimize site
Asked Answered
M

2

20

I was running page speed insights on my website and was given the following result:

Compressing resources with gzip or deflate can reduce the number of bytes sent over the network.

Enable compression for the following resources to reduce their transfer size by 350.1KiB (71% reduction).

Compressing https://static.xx.fbcdn.net/rsrc.php/v2/yV/r/jchZvGuNSq4.js could save 230.8KiB (72% reduction).

Compressing http://connect.facebook.net/en_US/sdk.js could save 119.3KiB (69% reduction).

I am wondering if anyone knows how to compress these files since they are served out directly from the facebook sdk?

This is the facebook script I am using in my webpages:

<script>
  window.fbAsyncInit = function() {
    FB.init({
      appId      : '---- my app ID here -----',
      xfbml      : true,
      version    : 'v2.4'
    });
  };
(function(d, s, id) {
  var js, fjs = d.getElementsByTagName(s)[0];
  if (d.getElementById(id)) return;
  js = d.createElement(s); js.id = id;
  js.src = "//connect.facebook.net/en_US/sdk.js#xfbml=1&version=v2.4";
  fjs.parentNode.insertBefore(js, fjs);
}(document, 'script', 'facebook-jssdk'));
</script>

Any help would be greatly appreciated as I have been unable to find a clear answer to this identified problem.

Melville answered 16/12, 2015 at 0:17 Comment(1)
developers.facebook.com/support/bugs/2348132535229110/… - They're probably not going to fix it, 3+ years already.Dactylic
C
3

I have also noticed this and went Googling and found your SO question. I did some checks and it looks like they already compress their static files. Have a look at this:

http://www.whatsmyip.org/http-compression-test/

EDIT: I recommend using https://checkgzipcompression.com/ now, the previously named test seems to have lost its functionality

I'm not sure why Pagespeed Insights doesn't pick up on this, but I am pretty sure you can ignore this. Because you don't have much influence on the way they serve their static files and I would be suprised if they didn't compress their static files at a company like Facebook.

Compartmentalize answered 6/1, 2016 at 8:50 Comment(2)
It's look like this tool doesn't report correctly. I've got a resource connect.facebook.net/signals/config/<redacted> (that doesn't use the Content-Encoding header): "Uncompressed Page Size: 178.6 KB, Compressed Page Size: 178.6 KB". If I use gzip (using default compression level), the resulting file size is 42,2 KoOrth
I have noticed the tool doesn't work anymore like it did back then. almost 3 years ago! I can't be held accountable for the tool changing functionality in the meantime. It's not my tool. I also can't be expected to keep check the validity of all my sources I name in all my SO answers I have given (voluntarily!). So it is kind of childish to downvote. I hope you are willing to upvote when I have found another working test. @Orth The point of my answer is still valid. I am the only one here that has given a constructive educational answer that the OP can use to improve his investigative skillsCompartmentalize
G
9

You can't. It's served from a third party which is Facebook. We should reach them out and ask them to compress these files.

Edit:

Facebook actually lent us an ear, and compressed some of their SDKs which is great

Gere answered 29/12, 2015 at 13:1 Comment(1)
@Sekai, can you please let us know which SDKs have they compressed ? Have they compressed the OPs SDKs ?Dactylic
C
3

I have also noticed this and went Googling and found your SO question. I did some checks and it looks like they already compress their static files. Have a look at this:

http://www.whatsmyip.org/http-compression-test/

EDIT: I recommend using https://checkgzipcompression.com/ now, the previously named test seems to have lost its functionality

I'm not sure why Pagespeed Insights doesn't pick up on this, but I am pretty sure you can ignore this. Because you don't have much influence on the way they serve their static files and I would be suprised if they didn't compress their static files at a company like Facebook.

Compartmentalize answered 6/1, 2016 at 8:50 Comment(2)
It's look like this tool doesn't report correctly. I've got a resource connect.facebook.net/signals/config/<redacted> (that doesn't use the Content-Encoding header): "Uncompressed Page Size: 178.6 KB, Compressed Page Size: 178.6 KB". If I use gzip (using default compression level), the resulting file size is 42,2 KoOrth
I have noticed the tool doesn't work anymore like it did back then. almost 3 years ago! I can't be held accountable for the tool changing functionality in the meantime. It's not my tool. I also can't be expected to keep check the validity of all my sources I name in all my SO answers I have given (voluntarily!). So it is kind of childish to downvote. I hope you are willing to upvote when I have found another working test. @Orth The point of my answer is still valid. I am the only one here that has given a constructive educational answer that the OP can use to improve his investigative skillsCompartmentalize

© 2022 - 2024 — McMap. All rights reserved.