Yes, inserting render-blocking elements in the headers is supported.
I'm not very accurate in the previous message. The current situation is
that Chrome cannot fulfill a render-blocking element to unblock the
renderer if it is inserted from the script.

For instance, this page will not work:

    <!doctype html>
    <head>
      <link rel="expect" href="#target-id" blocking="render"/>
    </head>
    <body>
      <script>
        var div_element = document.creteElement('div');
        div_element.id = 'target-id';
        div_element.textContent = 'test';
        document.body.appendChild(div_element);
      </script>
    </body>

On Wed, Mar 12, 2025 at 6:08 PM Noam Rosenthal <nrosent...@chromium.org>
wrote:

>
>
> On Wed, Mar 12, 2025 at 2:35 AM 'Jiacheng Guo' via blink-dev <
> blink-dev@chromium.org> wrote:
>
>> I have checked with @Vladimir Levin <vmp...@google.com>. Currently
>> chrome is not supporting inserting any kind of render-blocking elements
>> from javascript. Since it is a very practical use case we may work on
>> adding the support.
>>
>
> I don't think this is accurate. It's possible to insert render-blocking
> elements using javascript if the script is run before the parser sees the
> body element.
> Specifically for <link rel=stylesheet> it's the only utility of
> blocking=render as parser-inserted stylesheets are render-blocking to begin
> with.
>

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to blink-dev+unsubscr...@chromium.org.
To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CAJQw1NxJktboeOvkNG2nkwrhiWfu4ao8D3NaAbmoXp9C3DrWug%40mail.gmail.com.

Reply via email to