August 14th, 2024

Blocking=render: Why would you do that?

WebKit's blocking=render attribute delays rendering until scripts are fully loaded, improving user experience by preventing invisible interactions. It allows progressive rendering but may increase render-blocked periods based on browser heuristics.

Read original articleLink Icon
Blocking=render: Why would you do that?

WebKit has announced the implementation of the blocking=render attribute, which will prevent the parsing and rendering of subsequent content until a specified script, such as app.js, is fully fetched and parsed. This approach contrasts with the default behavior of other file types, which are non-blocking. The blocking=render attribute aims to improve user experience by avoiding the issues associated with anti-flicker snippets, which render pages invisibly before making them visible, potentially leading to user interaction with invisible elements. By allowing the browser to manage rendering, blocking=render facilitates a progressive rendering process, enhancing the overall experience. However, it introduces a risk of longer render-blocked periods, as the timeout for rendering is now determined by the browser's heuristics rather than a fixed duration. While blocking=render may not be necessary for all users, it provides a solution for those who require it, ensuring that content is not prematurely displayed.

- WebKit's blocking=render attribute prevents rendering until scripts are fully loaded.

- This method improves user experience by avoiding invisible page interactions.

- It allows for progressive rendering, enhancing overall site performance.

- The timeout for rendering is now based on browser heuristics, potentially increasing render-blocked periods.

- Not all users will need blocking=render, but it serves a specific purpose for those who do.

Related

Apple Disables WebKit's JIT in Lockdown Mode, & BrowserEngineKit Is Restricted

Apple Disables WebKit's JIT in Lockdown Mode, & BrowserEngineKit Is Restricted

Apple has disabled WebKit's JIT in Lockdown Mode for enhanced security, aligning with EU's DMA. BrowserEngineKit enables secure JIT compilation, balancing performance and safety, requiring authorized developers for alternative browser engines.

Apple Disables WebKit's JIT in Lockdown Mode

Apple Disables WebKit's JIT in Lockdown Mode

Apple disables WebKit's JIT in Lockdown Mode for security, affecting web browsing speed. BrowserEngineKit complies with EU's DMA, allowing third-party engines while ensuring security. Apple balances compliance, security, and performance.

The Cost of JavaScript

The Cost of JavaScript

JavaScript significantly affects website performance due to download, execution, and parsing costs. Optimizing with strategies like code-splitting, minification, and caching is crucial for faster loading and interactivity, especially on mobile devices. Various techniques enhance JavaScript delivery and page responsiveness.

How Google handles JavaScript throughout the indexing process

How Google handles JavaScript throughout the indexing process

A study analyzed Googlebot's interaction with JavaScript-heavy sites, revealing it successfully renders all HTML pages and debunking myths about its JavaScript handling, emphasizing modern rendering capabilities and SEO optimization insights.

Safari can block distracting ads and other website clutter with latest beta

Safari can block distracting ads and other website clutter with latest beta

Apple's Safari beta introduces Distraction Control, enabling users to block static web elements like subscription overlays. It also features a redesigned Reader mode and advises backing up data before testing.

Link Icon 7 comments
By @fevangelou - 8 months
Once ad agencies/networks take note of this feature, they will 100% start using it and abusing it.

We're already seeing some ad networks using initialization scripts to bootstrap their ad setup, with dynamically constructed secondary scripts that have a high fetchpriority (so they supposedly load faster than others).

For reference, modern news/media sites may load multiple ad networks (3-4 on average perhaps) in order to optimize ad performance (revenue) or inject different kinds of ads or sponsored content. If we take Google's Ad Manager (or similar) as the base network to serve ads (own or third-party), many times we see additional networks like AdSense, Taboola, Outbrain, Vidverto (to name a few) or other local ad networks that do some sort of header bidding, ad injection, sponsored content display, in-read ads/videos and so on.

I don't see why some won't abuse this spec to force-inject their stuff earlier than other ad networks and of course at the expense of a site's performance...

By @thanatos519 - 8 months
Could this be used to prevent me from clicking on or tapping the wrong thing because new items keep appearing causing a reflow just as I jab? I would really appreciate it if pages would render after they have made up their mind.
By @MathMonkeyMan - 8 months
> The short answer is: generally, you wouldn’t. Unless you know you need this behaviour, you don’t need it.

So... it will be on every website.

By @f33d5173 - 8 months
Seems like a summary is: "scripts that don't use document.write (the majority) can use this to marginally increase performance". Unless I'm missing something.
By @don-code - 8 months
I've noticed there's a behavior of newer React apps, to load the static text "You need to enable JavaScript to run this app" (or similar). It'd be nice if they could instead use this feature to gate rendering the page, as I assume that plugins like NoScript would be implemented to ignore it entirely and render whatever static content is there.

It'd for sure still be up to content designers to degrade gracefully.

By @CM30 - 8 months
The A/B testing use case is probably the one good one there, at least if you can't serve the variations on the server side. So many issues come from trying to overwrite the page without it flickering/being blatantly obvious to the user.