Post AVPgpR4ta3fsdFWH6u by simevidas@mastodon.social
(DIR) More posts by simevidas@mastodon.social
(DIR) Post #AVPgpOs3moDdmrUzpI by simevidas@mastodon.social
2023-05-07T12:23:43Z
0 likes, 0 repeats
A little experiment: Blocking non-critical scripts on imgur.com.I picked a random image page: https://imgur.com/gallery/8xL2nAW.First, I loaded the page in vanilla Chrome. I only scrolled by a small amount, to show the image and comments.The result:56 scripts, 5.7 MB of JavaScript (1.4 MB transferred)
(DIR) Post #AVPgpQLWIlNWMWI2Ns by simevidas@mastodon.social
2023-05-07T12:28:26Z
0 likes, 0 repeats
Then I installed uBlock Origin and set it up as follows:1. disabled all built-in filters (this turns *off* ad blocking)2. disabled JS globally3. turned on advanced mode4. blocked all scripts globallyThen on imgur.com:1. enabled JS2. allowed the two critical script domains: imgur.com and media-lab.ai
(DIR) Post #AVPgpR4ta3fsdFWH6u by simevidas@mastodon.social
2023-05-07T12:30:23Z
0 likes, 0 repeats
So now I block all non-critical scripts. I reload the page to confirm that the image (main content) renders fine.The result:21 scripts, 2.5 MB (682 kB transferred)
(DIR) Post #AVPgpRln0ZzAmHaWy8 by simevidas@mastodon.social
2023-05-07T12:45:41Z
1 likes, 0 repeats
What did I achieve?I more than halved the amount of JavaScript for imgur.com. But at what cost?There are no drawbacks as far as I can tell. There are only benefits: * the page loads faster* there is less scroll jank* the layout shift in the side column is goneTo sum up, by reducing the JavaScript, the user experience improved significantly. I think this shows that blocking non-critical scripts by default is worth exploring. I’ve been getting better at this in the past 10 months.