summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarit.de>2025-08-19 10:05:42 +0200
committerMarkus Heiser <markus.heiser@darmarIT.de>2025-08-21 09:07:08 +0200
commitd2b3c92e81efbba7ec62395ed5203d819c75d74a (patch)
tree539a44d5eeae862aa57e3f28a68d632d78cdd1e4 /docs
parent41a4a3e224f5fa90522253da4236dd9a6f4083cb (diff)
[fix] move initial "JS is enabled?" (no-js) to client side
To avoid an `unsafe-inline` in the CSP header, the JS code must be moved to the client side [1]. The `<script>` tag at the end of the HTML originates from the old implementation of the JS client. Since PR-5073 [2] was merged, the `type` is now `module`, and the tag must be moved to the beginning of the HTML. > We need to inline this "JS is enabled?" thing to prevent layout shifts and > temporary "no JS enabled" visuals as ESM scripts loads and evals everything > deferred from initial DOM render [3] That's true in theory, but in practice, this effect is unnoticeable because it's masked by another effect (which we can't avoid): If we load the page with a severely throttled connection, the HTML (result list) takes a long time to load. Then the CSS is loaded, which also takes longer. Until the CSS has loaded, there's no layout. A layout shift is therefore largely determined by the loading of the HTML and CSS itself. The running times of the ESM script can be neglected compared to the loading times of HTML & CSS. [1] https://github.com/searxng/searxng-docker/pull/424#issuecomment-3199494256 [2] https://github.com/searxng/searxng/pull/5073 [3] https://github.com/searxng/searxng-docker/pull/424#issuecomment-3199622504
Diffstat (limited to 'docs')
0 files changed, 0 insertions, 0 deletions