Third party

The web turned 30 this year. When I was back at CERN to mark this anniversary, there was a lot of introspection and questioning the direction that the web has taken. Everyone I know that uses the web is in agreement that tracking and surveillance are out of control. It seems only right to question whether the web has lost its way.

But here’s the thing: the technologies that enable tracking and surveillance didn’t exist in the early years of the web—JavaScript and cookies.

Without cookies, the web was stateless. This was by design. Now, I totally understand why cookies—or something like cookies—were needed. Without some way of keeping track of state, there’s no good way for a website to “remember” what’s in your shopping cart, or whether you’ve authenticated yourself.

But why would cookies ever need to work across domains? Authentication, shopping carts and all that good stuff can happen on the same domain. Third-party cookies, on the other hand, seem custom made for tracking and frankly, not much else.

Browsers allow you to disable third-party cookies, though it’s not yet the default. If enough people do it—and complain about the sites that stop working when third-party cookies are disabled—then maybe it can become the default.

Firefox is taking steps in this direction, automatically disabling some third-party cookies—the ones that known trackers. Safari is also taking steps to prevent cross-site tracking. It’s not too late to change the tide of third-party cookies.

Then there’s third-party JavaScript.

In retrospect, it seems unbelievable that third-party JavaScript is even possible. I mean, putting arbitrary code—that can then inject even more arbitrary code—onto your website? That seems like a security nightmare!

I imagine if JavaScript were being specced today, it would almost certainly be restricted to the same origin by default. But I guess the precedent had been set with images and style sheets: they could be embedded regardless of whether their domain names matched yours. Still, this is executable code we’re talking about here: that’s quite a footgun that the web has given site owners. And boy, oh boy, has it been used by the worst people to do the most damage.

Again, as with cookies, if we were to imagine what the web would be like if JavaScript was restricted by a same-domain policy, there are certainly things that would be trickier to do.

  • Embedding video, audio, and maps would get a lot finickier.
  • Analytics would need to be self-hosted. I don’t think that would bother any site owners. An analytics platform like Google Analytics that tracks people across domains is doing it for its own benefit rather than that of site owners.
  • Advertising wouldn’t be creepy and annoying. Instead of what’s so euphemistically called “personalisation”, advertisers would have to rely on serving relevant ads based on the content of the site rather than an invasive psychological profile of the user. (I honestly think that advertisers would benefit from this kind of targetting.)

It’s harder to imagine putting the genie back in the bottle when it comes to third-party JavaScript than it is with third-party cookies. All the same, I wish that browsers made it easier to experiment with it. Just as I can choose to accept all cookies, reject all cookies, or only accept same-origin cookies, I wish I could accept all JavaScript, reject all JavaScript, or only accept same-origin JavaScript.

As it is, browsers are making it harder and harder to exercise any control over JavaScript at all. So we reach for third-party tools. We don’t call them JavaScript managers though. We call them ad blockers. But honestly, most of the ad-blocker users I know—myself included—are not bothered by the advertising; we’re bothered by the tracking. We should really call them surveillance blockers.

If third-party JavaScript weren’t the norm, not only would it make the web more secure, it would make it way more performant. Read the chapter on third parties in this year’s newly-released Web Almanac. The figures are staggering.

93% of pages include at least one third-party resource, 76% of pages issue a request to an analytics domain, the median page requests content from at least 9 unique third-party domains that represent 35% of their total network activity, and the most active 10% of pages issue a whopping 175 third-party requests or more.

I don’t think all the web’s performance ills are due to third-party scripts; developers are doing a bang-up job of making their sites big and bloated with their own self-hosted frameworks and code. But as long as third-party JavaScript is allowed onto a site, there’s a limit to how much good developers can do to improve the performance of their sites.

I go to performance-related conferences and you know who I’ve never seen at those events? The people who write the JavaScript for third-party tracking scripts. Those developers are wielding an outsized influence on the health of the web.

I’m very happy to see the work being done by Mozilla and Apple to normalise the idea of rejecting third-party cookies. I’d love to see the rejection of third-party JavaScript normalised in the same way. I know that it would make my life as a developer harder. But that’s of lesser importance. It would be better for the web.

Have you published a response to this? :

Responses

danq.me

We should spend less time reading and more time writing online. Dan’s comments on an inspiring essay.

# Wednesday, October 2nd, 2019 at 8:10am

Tom Tinkerson

“In retrospect, it seems unbelievable that third-party JavaScript is even possible. I mean, putting arbitrary code—that can then inject even more arbitrary code—onto your website? That seems like a security nightmare…” adactio.com/journal/16099

Aaron Crowder

I love this line of thinking about third party cookies and JavaScript. Both of these things should be opt-in, NOT opt-out. I should have to manually CHOOSE to accept them.

Timo Häkkinen

“In retrospect, it seems unbelievable that third-party JavaScript is even possible. I mean, putting arbitrary code—that can then inject even more arbitrary code—onto your website? That seems like a security nightmare!” adactio.com/journal/16099

Craig Buckler

“If third-party #JavaScript weren’t the norm, not only would it make the web more secure, it would make it way more performant.” “Third party” by @adactio - adactio.com/journal/16099 Your site’s security, privacy & performance is only as good as the worst third-party JS provider.

terribleideas.me

Jeremy Keith makes excellent point about surveillance and tracking being out of control. His article Third Party is here.

# Wednesday, November 13th, 2019 at 3:05pm

Friday Front-End

Third party: “In retrospect, it seems unbelievable that third-party JavaScript is even possible. I mean, putting arbitrary code—that can then inject even more arbitrary code—onto your website? That seems like a security nightmare!” by @adactio adactio.com/journal/16099

Paul Shryock

“In retrospect, it seems unbelievable that third-party JavaScript is even possible. I mean, putting arbitrary code—that can then inject even more arbitrary code—onto your website? That seems like a security nightmare!” adactio.com/journal/16099

1 Share

# Shared by Ayşe Kongur on Tuesday, November 12th, 2019 at 5:41pm

7 Likes

# Liked by Ayşe Kongur on Tuesday, November 12th, 2019 at 6:11pm

# Liked by Aleksi Peebles on Tuesday, November 12th, 2019 at 6:11pm

# Liked by Rafal Kruk on Tuesday, November 12th, 2019 at 9:33pm

# Liked by Chris M. on Wednesday, November 13th, 2019 at 11:18am

# Liked by Chris on Thursday, April 16th, 2020 at 10:12am

# Liked by Future Sync Conf on Thursday, April 16th, 2020 at 10:13am

# Liked by Brian LeRoux on Thursday, October 22nd, 2020 at 3:39pm

2 Bookmarks

# Bookmarked by Chris Aldrich on Sunday, November 17th, 2019 at 3:26pm

# Bookmarked by Jamie Tanna on Sunday, November 24th, 2019 at 11:10pm

Related posts

Progressively enhancing maps

How I switched to high-resolution maps on The Session without degrading performance.

Responsibility

Fear of a third-party planet.

GDPR and Google Analytics

Do you have permission for those third-party scripts?

Heisenberg

JavaScript and the observer effect.

On The Verge

Verging on the ridiculous.

Related links

The environmental benefits of privacy-focussed web design - Root Web Design Studio

Even the smallest of business websites now seems to have cookie popups simultaneously telling us they ‘value your privacy’ while harvesting data about who we are, where we are, what we’re looking for and what we were doing online before we landed there.

Tracking scripts have become so pervasive that they have effectively become an industry standard, and most businesses deploy them not only without question, but without consideration of what it means for customer privacy.

Tagged with

Tagged with

In and Out of Style · Matthias Ott – User Experience Designer

Some thoughts—and kind words—prompted by my recent talk, In And Out Of Style.

Tagged with

Web Almanac 2020

I spent most of the weekend reading through this and I’ve still barely scratched the surface—a lot of work has gone to the analyses and write-ups!

The sections on accessibility and performance get grimmer each year but the raw numbers on framework adaption are refreshingly perspective-setting.

Tagged with

Old CSS, new CSS / fuzzy notepad

I absolutely love this in-depth history of the web, written in a snappy, snarky tone.

In the beginning, there was no CSS.

This was very bad.

Even if you—like me—lived through all this stuff, I guarantee there’ll still be something in here you didn’t know.

Tagged with

Previously on this day

13 years ago I wrote Pursuing semantic value

Agreeing and disagreeing with Divya.

15 years ago I wrote Collective action

Ajax feedback inspired by video games.

17 years ago I wrote Delusion

Agreement and disagreement.

23 years ago I wrote Procrastination

I spent most of today making tweaks and changes to my little portal.