JavaScript is Ruining the Web

A developer argues JavaScript has bloated the web: typical pages load 6 MB uncompressed code, taking 13 seconds on average phones, costing users real money in data plans. JavaScript enables tracking and surveillance, rewards lazy developers importing massive libraries, and complicates SEO by forcing Google to render before indexing.
Chapters
Thanks everybody for sticking around for this bit. I realize I'm the last thing standing between you and free beer, so I do appreciate that. If you're expecting a useful talk where you can learn things and have actionable insights, you're in the wrong fucking room right now. You've had plenty of opportunities today to go to useful and insightful and actionable talks. This is me just ranting for the next 20 minutes. I'm not going to keep you too long, because I want a fucking beer too. But yeah, we're going to talk about JavaScript, which for those of you who are vaguely familiar with my oeuvre will know that it's not exactly my favorite technology. It all sort of goes back to this talk that I gave last year at Learn Inbound, where a recurring theme throughout the whole talk was that JavaScript is evil. And I genuinely believe that. I don't just say that to solicit laughs, although that serves a purpose. It's not just for pure entertainment value, it's because I actually do believe JavaScript JavaScript is evil. And it's sort of taken on a life of its own, and it even gets referenced now in official Google videos where they make a point to say, no, JavaScript is not actually evil, it's just misunderstood. No, it is actually evil. And I'm going to talk to you today why I do believe JavaScript is evil and probably lies at the root of all of the problems, or most of the problems, that the web is having right Now, first we have to explain a little bit about what JavaScript actually is, because that again lies at the root of why it's a problem. It's a client-side scripting language, which means that the code is sent in unfiltered, uncompiled form to the client, usually a web browser, which then compiles it and executes it and does whatever it needs to do, usually about communicating back to the server in a sort of real-time context. So the server doesn't do any of the heavy lifting, the server just sends the code to the browser, and the browser, usually you on your mobile phone, you do the heavy lifting, you execute the code, and you get that rich experience hopefully off the back of it. But JavaScript of course serves a lot of different purposes across the entire web, it's not just about making web pages come to life, it's also about using code running in your browser to track you and to serve you ads. The beauty of JavaScript is, which is why it's such a popular format, that coders, programmers, developers only need to write it once. They write one set of JavaScript and then it runs on your iPhone, on your Android phone, on your Windows phone— does that still fucking exist?— on BlackBerrys— again, does anybody here still have a bloody BlackBerry?— etc., etc. Which is why it's such a very popular language. It means, you know, you can write code and create experiences that are independent of the platform it's going to be running on. Which, you know, makes a lot of sense. The web sort of needed that sort of client-side scripting code to enable it to grow and to become more useful and to become more valuable and do more of the cool shit that we now expect of web pages. Cool shit like me haunting you all across the web with these SysTrix ads. If you ever visited the SysTrix blog, you will be haunted all across the internet by ads like that. It's not just me, there's like 7 or 8 different people who have lent quotes and photos to those SysTrix banners, and I still get emails from people who see my face haunting them all over the internet. I think the problem that SysTrix have made is that, now it's a nice idea, but they didn't set a limit on the amount of times you're shown these things, which means they get really fucking annoying. It's also why I have an ad blocker installed, but that's a different story. The problem with JavaScript is that it causes a lot of bloat. I'm not even fucking joking here. This is a normal web page on a fairly well-visited popular website. They have 67 different JavaScript files that are being loaded for a total of 1.7 megabytes compressed data being sent across the internet, but it's nearly 6 megabytes when it's uncompressed. When it's uncompressed and then compiled and executed as actual code in your browser. Holy fuck. Are we fucking serious here? I mean, I don't know about you, but for me, data isn't exactly free. You have to pay for that shit. You might not realize it, but you're paying for that shit. You're paying for the privilege of looking at a web page. And pages are getting bigger and bigger all the time. This is from the HTTP Archive. They keep track of the average size of a web page in kilobytes. And it's only gone up. Since 2010, on mobile devices, the average size of a web page has gone up by 1,000%. What? Like, seriously, people? 1,000%? 1.6 megabytes, the average web page is nowadays. So if you look at 10 web pages, you've already consumed 16 megabytes of your data plan. You look at 100 web pages, which is not that much, 160 megabytes. 1,000 web pages, and you're probably going to run across your data limit fairly quickly. But, yeah, you know, it's 4G, we've got 5G coming, why should we worry too much about this? You know? You know, stuff that happens in the background. Phones are getting faster, data is getting faster. It's not really a problem, is it? Well, you are paying for that fucking privilege. The UK has some of the most expensive data plans in Europe. Not the most expensive, by the way, because that privilege belongs to Switzerland. If you live in Switzerland, you're really fucked. Really fucked. I mean, seriously, can you imagine that? Paying $20 on average for 1 gigabyte of mobile data? Germany is slightly worse even than the UK. But no, it would be lovely to live in France, which is a lot cheaper than that. Of course, you'd have to deal with the French, which is a different problem. But yeah, you're paying for the privilege of looking at other people's websites. You're paying for the privilege to be advertised to. So basically, you're paying twice. You're paying with your attention, you're paying with your fucking data plan. And that is just part of the equation. Because all that JavaScript, all those 7, 8 megabytes of JavaScript that are being downloaded and running in your browser, is running on your phone, and those phones aren't exactly getting cheaper either. A phone basically is a collection of chips, mainly CPUs and storage, and some software runs on it, and you get a nice little screen on it. It's a very attractive device, and you spend half your fucking day staring at the bloody thing because it's so bloody addictive, partially because of the cool experiences we get served through JavaScript, but they're not getting cheaper. In fact, they're getting more and more expensive. Who here has an iPhone 8? X or newer, I'm guilty of that, that shit is £900 fucking pounds. But hey, we love it, right? It's a cool device, yay! Facebook, Facebook, Facebook. It's terrible. More and more expensive, so we're paying for that, we're paying for that privilege of using websites, and our phones are doing the heavy lifting. All the CPU, all the data storage, that 7, 8 megabytes per web page is being stored on your mobile phone. And then, of course, it does all this funky shit in the background. This is from a while back ago, Adios Money, who actually works for Google, ironically enough. He did some studies on how long it takes the average phone to execute the JavaScript on CNN.com. And the average phone there in the middle of the red takes, you know, 13 fucking seconds. 9 seconds slower than the high-end phone to actually execute all the JavaScript that's being loaded on just a single web page. If you're unfortunate enough to not have enough money to buy an iPhone X and you have to do with a slightly lower spec phone, you're really fucked. You're staring at the thing for like 36 seconds before that page is loaded and does all the bells and whistles it needs to do. You're probably not going to wait 36 seconds to look at CNN.com, are you? That's a lot of extra effort. And this is just normal. This isn't getting any better. This is getting worse. The web is not getting faster, it's getting slower, ironically enough. There was a— I think, when was it that Google first said that load speed was going to be a ranking factor? Back in 2008, 2009? And then a year later they said that after they made that declaration, the average load speed on the web has gotten slower by like 2 seconds. So they're like, oh yeah, we need to make the web faster, and the exact opposite happened. Still happens today. Basically what JavaScript is making us do is cracking that whip and making us as the consumers do the heavy lifting. Our devices, our data, we are paying the price for other people's websites having all these fucking bells and whistles on it. These bells and whistles are not entirely for our own benefit. They're not there to make the world a better place. They're there to sell us shit that we don't actually need. They're there to advertise to us and make us buy shit that we don't really want, but we think we want. But that's just a side effect. That's not even the worst part of it. In the context of SEO and Google, JavaScript is of course a massive problem. I'm not gonna be talking a lot about that today because that horse has been beaten to death several times over. There's a lot of content out there on JavaScript and Google, so I'm not gonna rehash all of that. All you really need to know is that Google also has to put in all that effort to download and render and execute all that JavaScript. And Google says, you know what, I'm gonna do my best, but it's gonna take some extra time. They say it defers, they defer the loading of JavaScript until resources become available. Now we're talking about Google here, they have so much fucking processing power, it's outrageous. They have data centers everywhere, hundreds and hundreds of thousands of server farms, hundreds and hundreds of thousands of servers in each fucking farm, constantly grinding away, crawling the web, indexing the web, et cetera, et cetera. And they are complaining that they don't have enough CPU power to render JavaScript all the time, they can't do it in real time, it's too expensive for fucking Google. That's how much JavaScript costs. So that's the main problem of JavaScript in the context of search, the context of SEO, that Google has to do all this extra heavy lifting and that they have to wait until those resources become available before they can actually do that. And then of course the big issue with JavaScript is privacy. The data that all that code is harvesting from you, the consumer, the end user, the person staring at your phone right now, sending a snarky tweet to whoever it is, Barry's talk is shit, let's go get that beer. That data is being harvested, mined real-time, sent to all kinds of data centers, advertisers, you name it. And who knows how that's being used, right? Who knows what's happening? Well, actually, we have a fairly good idea, because if you've been to any of the advertising talks here today, you'll know exactly how good They know who you are and what kind of shit you want to buy and all of that. But the real problem is, of course, that it's not just the corporations that are doing this. I mean, the Facebooks and Googles of this world, they have all the data, but, you know, I genuinely believe no matter how much I complain and moan and bitch about Google, and I do that quite a lot, I don't believe they have bad intentions. I really don't think that they as a company intend to be evil bastards. I do think they're just trying to do the best that they can. I worry more about the governments behind there and other companies who can just plug into that data. I mean, we haven't forgotten PRISM yet, have we? All those leaks from Edward Snowden? We seem to have just collectively forgotten what a big fucking issue that was. But we have to realize that at a fairly early stage in the development of the web, the big intelligence agencies like the NSA and the CIA realized they didn't need to build Their own online spying infrastructure. They started building that and then they realized, why are we doing this? All we really need to do is take a big fat cable, plug it into the back of Google and Facebook and Apple, and voilà, we've got everything. Everything. In fact, nowadays you just need Google. You don't even need Facebook anymore. Plug it into Google, you have everything you need to spy on everybody and everything they do all over the web. Because Google is not just Google Search, as we know, it's also YouTube, and more importantly, it's Android. Most people here will have an Android phone. I think in the UK they have like 80 to 90% market share. Everything you do on that fucking phone, Google knows about. Everything. There was an experiment done not that long ago, if you'll allow me a little bit of a tangent, where they took an Android phone and an iPhone and they just sat it down face down on the table doing nothing, nothing running, and measured how often it was communicating back to HQ. How often, how many times an hour it was talking and sending data back about where it was, what it was doing, et cetera, et cetera. I think the iPhone did it like 4 times in an hour. The Android phone like 80 times in an hour. Don't use Android, people. And of course, we can't forget these fuckers. They don't exist anymore, but, you know, they were sort of a proof of concept. You know what you can do if you take all this useful technology with targeted advertising, but then you advertise with bad intentions? What happens? Well, this fucking happens. I am a Dutchman living in Northern Ireland. I do not have to explain to you what my feelings are about this. I hope. And of course, this too was just a test case. This was like Cambridge Analytica saying, can we actually pull this shit off? The answer is yes, we can. Well, let's see if we can go one step higher. Hello, welcome to the orangutan. That's unfair on orangutans, by the way, because they have bigger hands and higher IQs on average. Again, you know, this shit is because the technology enables it. The technology actively encourages that shit. This doesn't just happen overnight. This is because the web has allowed us to build systems where we can manipulate people on a massive scale in such a way that we can change the course of nations. Bad actors are jumping all over that shit. You don't need to be living in North fucking Korea to be living in a dystopian nightmare. Right here, right now, our own fucking version of the orangutan is inches away from Number 10 Downing Street. And then we have the Hawthorne effect. Anybody hear about that? Also known as the observer effect. This, I think, is the most dangerous part of it. It's a psychological phenomenon where if you as a person are aware that you're being watched, that you're being observed, even if you're not consciously thinking of it, but it's a subconscious awareness that you're being watched, you alter your behavior. You're not really your normal self. You change how you do things, what you say. How you say it, etc., etc. And I think subconsciously, by now, all of us know we are always being watched. There is no hiding. Everything we do online is being harvested and data-mined and stored in some database somewhere. And we are altering our behavior off the back of that. Whether you accept it or not, whether you're consciously aware of it or not, you are doing this. Can we be truly free as people if we alter our behavior because we know other people, other actors, other institutions, other systems, machine systems, are watching what we do? Are you a free person? Now that's a philosophical question I'm not really going to go into. That would sort of ruin the effect of this rant anyway, because I'd probably be nodding off after 5 minutes. But my key message here is that technology is not neutral. Neutral. Technology does not exist in a vacuum. It doesn't just exist for its own purpose. Technology encourages certain behaviors. When the internal combustion engine was invented at the start of the last century, that was not a neutral technology. In fact, it was a technology that in the short term encouraged people to kill one another unintentionally by going really, really fast on roads. And as a result, Internal combustion engines, specifically in the latest iteration, cars and motorcycles, are some of the most regulated technologies out there. There's a lot of rules governing what you are allowed and what you're not allowed to do with internal combustion engines, specifically vehicles powered by internal combustion engines. There's a lot of rules. We don't have rules for JavaScript. No. You can do whatever the fuck you want. And that's the problem, because those bloated fucking websites, all that data mining, all that harvesting, JavaScript encourages encourages that. It's a technology that practically rewards people who build and design websites to build that in. Because if you're not doing that, you're being punished. If you're not doing targeted advertising, you're not being as effective as your competitor. If you're not building those Wix experiences on your website, other people say your website is shit and they're going to go to your competitor. So it's a technology that encourages that sort of behavior. You cannot escape from that. It's not a neutral technology. It has an alignment. Anybody here play Dungeons and Dragons? A little bit of geek power here, yes? When I put JavaScript in this box, well, let's start with the web, by the way, the World Wide Web first. It's fairly neutral, but I would call it chaotic neutral because it can go in any really given direction. As a platform, it's probably the closest you can get to a true neutral technology because the web has also enabled fantastic things to happen. It's a platform. It's not just a total shitfest of privacy invasion and tracking and advertising technologies. HTML I'd probably put in the good box. HTML is a language, it's not really a coding language, it's a markup language. And it's really hard to fuck up HTML. It's really hard to do bad things with HTML. It's possible, but you have to actively try to make that happen. By default, HTML is just fairly decent as a technology. JavaScript, on the other hand, I would call that lawful evil because it fucks up every single time unless you actively discourage it from doing so. By default, JavaScript is lawful evil. It is an evil technology that does evil things. It's an evil technology because you can install a 7 fucking megabyte JavaScript jQuery library to do one thing on your website to make it sparkle. And that's what lazy developers do. Like, oh yeah, oh, there's a library for that. We just install the library and voilà, it works. Hey, close the JIRA ticket, off we go. No, you fuckhead! By the way, John Mueller, I would call lawful good. The man is just a delight, isn't he? Do I want JavaScript to disappear? Do I want it to just sink in a hole and go away for fucking ever because it's evil? Actually, no, I don't want it to do that because, you know, it exists, it's here, we can't uninvent it. No matter how shitty it is, we sort of have to live with it. Plus, it has actually given us some benefits, believe it or not. Because if it wasn't JavaScript, it would have been something else. The web needed client-side code to enable that next level of technology, the next level of interaction, the next level of cool features. Anybody recognize this, by the way, what language this is? HTML. ActionScript. ActionScript, exactly. 10 points for whoever said that. ActionScript is based on Flash. Yes, people, this was the biggest rival to JavaScript in the early days of client-side technologies. Flash. Can you imagine if we, instead of JavaScript, we had Flash-based code everywhere? Could you imagine the shitfest that would have been? Oh my God. That would have been awful. So, we're sort of lucky that it became JavaScript rather than ActionScript. Holy shit. On top of that, JavaScript can be done fast and lightweight and clean. You don't have to have a massively bloated JavaScript library to have an awesome website. If you have a good developer who doesn't just press a fucking download jQuery button and put the whole library in there, but says, no, let's just see what the actual code is that we need and just just use that code and not use anything else, then you end up with really fast-loading websites. 12 JavaScript files clocking in at not even 200 kilobytes of data when it's compressed and sent over the line. That's neat, that's clean, that's fast. I like that. That's how you distinguish bad developers from good developers. Ask them if all the JavaScript features and functionality that they use on the website, if they could manually code that without libraries. If you get a blank look, you're dealing with a lazy developer. If you think, no, I did that, then that's a good developer. Cherish those people, they're very, very valuable. Also, let's be honest, we as SEOs make a fuck ton of money off JavaScript. I mean, seriously, I love it when I get hired by a client who works with lazy developers because it means I have a lot of shit I can make them fix, there's a lot of gains to be made there. Which means we could be making money as SEOs, and again, good developers will be worth their weight in gold as well because they can clean up the mess that other people have left behind. So, it's job security. This is one of the reasons why I don't want JavaScript to disappear. In fact, I practically encourage people to use client-side JavaScript frameworks because it means at some stage they're going to come to me. And they can hire me. Ka-ching! Also, it has exposed the dangers of the web. It has exposed the evil that underlies these technologies. You know? Like I said, if it wasn't for JavaScript, it would have been something else. So at least now we've been aware of it. The public awareness of all this nastiness happening in the background with all this targeted advertising, this high degree of personalization, this tracking, this data mining. We're becoming aware of it. A public discussion is starting to grow. About that. And you have movements like this, the ethical design movement, encouraging web designers and web developers to build technologies in such a way that, you know, you have the right values built into it from scratch. So you're not inadvertently building something that can be used for evil. I'm pretty sure Mark Zuckerberg, were he able to go back 15 years and redesign Facebook, he'd probably do it slightly differently. I mean, look at this. This is Solid. This is a sort of rethinking of the web by Sir Tim Berners-Lee. He's the man behind it. That's the man who invented the web. Even he is going, well, that turned into quite a shit show. And said, let's try and do that again. Let's try and make that better. That's how far we've gotten. But at least the right people are behind that. So, yeah, JavaScript is not going to disappear. Evil, obviously. But we shouldn't get rid of it. We have to hang on to it and make the best of it that we can, because otherwise we're even digging an even deeper hole for us. At least it's the devil we know right now, rather than whatever might fill in that particular vacuum and void. That's all that I really have. I hope that wasn't as hard of a talk to sit through as you may have thought. Thank you. imagined. Um, there's free beers waiting for you. Thank you very much. Thank you.
More from Barry

NewzDash Webinars: Barry Adams ON Advanced Tech SEO for News Publishers and LIVE Q&A









