Hi,
On Thu, Oct 21, 2021 at 1:15 AM Greg Dunn <[email protected]> wrote:
> I'm using the following code under Wicket 9 to load a CSS file
>
>
>
> private static final ContextRelativeResourceReference CSS_FILE =
>
> new ContextRelativeResourceReference("style/cssFile.css",
> false);
>
>
>
> @Override
>
> public void renderHead(IHeaderResponse response) {
>
> response.render(CssHeaderItem.forReference(CSS_FILE));
>
> super.renderHead(response);
>
> }
>
>
>
> When the page loads the CSS is not rendered at all. Looking at the source
> I see the link to the CSS file with a nonce as expected. If I refresh the
> page in the browser then it renders with the CSS as expected.
>
"When the page loads the CSS is not rendered at all." -> this sounds like
the <link> is not rendered on the first load
"Looking at the source I see the link to the CSS file with a nonce as
expected." -> this sounds like the <link> is rendered properly on the
second load
"If I refresh the page in the browser then it renders with the CSS as
expected." -> on the third load it works again
So, it seems it does not work only on the first load! Correct ?
Are there any JavaScript errors in the browser console ?
Try disabling temporarily CSP. Maybe the nonce is not correct on the first
load and the browser prevents the loading.
>
>
> I would appreciate any assistance in resolving this. Thanks.
>
>