Live data from Hacker News

16% of the code on the average site belongs to Facebook

medium.com

31–40 of 54 posts

Re: 16% of the code on the average site belongs to Facebook

#31

Earlier quoted context omitted.

Probably because technically HTML isn’t so much code as it is a markup language

This seems intuitively to be the case but I wonder what others think. Neither HTML not CSS have your regular programming language constructs like loops and state and what have you. I sometimes teach very basic web tech to arts/humanities students and I tend to make a static versus dynamic distinction for them between HTML/CSS on the one hand and JS on the other because to them it's all "codey stuff" but to me there's…

> This seems intuitively to be the case but I wonder what others think.

I've not clicked through the article, but before I saw any comments here, I thought it was claiming that 16% of the HTML on the average site was devoted to Open Graph Stories markup, like / share buttons, and other embedded FB widgets.

(But that was already primed in my mind, as a couple of days I'd been examining the source of a website that had a ludicrously huge Head section, and it was filled with Facebook sharing markup.)

Re: 16% of the code on the average site belongs to Facebook

#32
> "If you need to use a feature like Facebook Comments, there’s no getting around the need to load the Facebook SDK."

Actually, you can import facebook comments directly into your sites internal commenting system. There's an opensource plugin in wordpress to do this. Then visitors aren't bogged down by loading facebook comments, since those are already integrated in.

Re: 16% of the code on the average site belongs to Facebook

#33

Earlier quoted context omitted.

This seems intuitively to be the case but I wonder what others think. Neither HTML not CSS have your regular programming language constructs like loops and state and what have you. I sometimes teach very basic web tech to arts/humanities students and I tend to make a static versus dynamic distinction for them between HTML/CSS on the one hand and JS on the other because to them it's all "codey stuff" but to me there's…

> This seems intuitively to be the case but I wonder what others think. I've not clicked through the article, but before I saw any comments here, I thought it was claiming that 16% of the HTML on the average site was devoted to Open Graph Stories markup, like / share buttons, and other embedded FB widgets. (But that was already primed in my mind, as a couple of days I'd been examining the source of a website that had…

Interesting. I would have never assumed as you did precisely because 16% of markup is a drop in the bucket compared to 16% of code (or CSS, even).

Re: 16% of the code on the average site belongs to Facebook

#34
I stopped reading after about 30 seconds. "Ben Regenspan" - the author of the piece didn't get the memo that the tag was removed from the HTML spec because it annoyed the hell out of every single person on planet earth and decided that some annoying little blinking gif was the right profile picture on Medium. Distracting and annoying as anything, so stopped reading.

Re: 16% of the code on the average site belongs to Facebook

#35

Earlier quoted context omitted.

Probably because technically HTML isn’t so much code as it is a markup language

This seems intuitively to be the case but I wonder what others think. Neither HTML not CSS have your regular programming language constructs like loops and state and what have you. I sometimes teach very basic web tech to arts/humanities students and I tend to make a static versus dynamic distinction for them between HTML/CSS on the one hand and JS on the other because to them it's all "codey stuff" but to me there's…

Turing incomplete code (sql, bpf, agda) is code. ergo markup is code. imo, ymmv.

Re: 16% of the code on the average site belongs to Facebook

#36
post #27

I mistakenly assumed this was going to be about the React PATENTS file.

I, too, expected to read about all the open source projects from FB.

Always surprises me how often the React devtools icon lights up indicating a React-based site. Maybe there are false positives, never investigated.

I don't really follow who's using React, but was surprised to see it on Dropbox.com.

Wonder how high the percentage would be if it included the library code for all FB projects?

Re: 16% of the code on the average site belongs to Facebook

#37
post #26
post #24

I've built my service https://urlscan.io to some extent to be able to track the impact of certain scripts / hosts on the overall size of the website. You can find the breakdown by hostname under "Request Stats" on the right. But, for this use case, it would be perfectly sufficient to use the Chrome Devtools and filter by "facebook" for example. Here is a scan where the 200KB Facebook sdk.js is being transferred (62KB…

Facebook's like button code generator tool[1] includes the entire SDK even if you configure it to only show a like button with no other social graph features. I guess there is an argument that having every site that uses Facebook's API having the same .js file will take advantage of browser caching better but it's still irritatingly wasteful. [1] https://developers.facebook.com/docs/plugins/like-button

The caching argument is solid though. I think it's the best cached piece of js after google analytics.

Should still affect the parse time and overall responsiveness of pages though.

Re: 16% of the code on the average site belongs to Facebook

#38
post #7

Earlier quoted context omitted.

It's 200KB minified, 60KB gzipped, so not quite that bad but still quite large. It definitely does more than you'd expect from the documentation on a page like https://developers.facebook.com/docs/plugins/like-button , and then there's all the other stuff I noted in OP like it including a ton of polyfills and legacy code. An example feature the SDK gives you is the ability to subscribe to an event that's triggered on…

> subscribe to an event that's triggered once the user successfully adds a Like A.K.A. the "like this page in order to enable the download link below" API. I wish they'd never made it; it has so many evil use-cases and I can't think of a single non-evil one (that wouldn't be better served by just async querying aggregate data.)

I don't think that you can easily check if the user already liked your page so that approach would not work.

Re: 16% of the code on the average site belongs to Facebook

#39
post #15

Earlier quoted context omitted.

Was the title changed? As it is, it clearly says '16% of the code', and to me that does imply only the javascript.

I think most people would consider HTML and CSS "code", too. Why would you not count HTML if it's in its own file, but assuming you would count it if it was JSX returned from a React component?

html not code. css maybe. the pedant has spoken, so it shall be, in my mind
Post reply on HN