Hacker News new | ask | show | jobs
by eli 815 days ago
Yeah but the critical piece here is loading Early Hints happens before the HTML is sent to the browser. So the server can change the HTML of the page based on what the browser does. (I wonder about the performance impact of this though.)

Trying to detect adblock via a <link> (or an <img> or a <script> etc) means you have to do the check in javascript, which can be manipulated by the browser.

2 comments

No, not neccesarily.

With the link http header (different from the <link> tag) you just send the http headers, but can still change the response body based on what the browser does.

Alternatively, By sending just the start of the document, then pausing, you can change the rest of the document based on what the browser does with the start, since browsers start loading css/js referenced in the document before the main document completes loading. (Before web sockets were a thing, this was basically the technique used for that sort of thing, called "long polling")

None of this requires javascript.

You can send some content (<link>) and then wait for something else to happen (prefetch) before you continue sending the rest of the content (the page).