Hi, thanks for your response and assistance.

Disabling strict CSP did not make any difference.

You are correct that the problem only happens on the first page load.

In the console for that page load I do see errors below.  These are all gone 
when the page is relaoded:


Every JavaScript file I'm loading gets this error:

        Uncaught SyntaxError: Unexpected token '<' - 
applicationUtils-ver-3…298D978F3B42A7.js:1 

I see this error twice in JavaScript that is rendered into the header by Wicket:

        Uncaught ReferenceError: Wicket is not defined

                Wicket.Ajax.baseUrl="pages/MyPageForm?session=qN46B2h...
                Wicket.Event.add(window, "domready", function(event) {  

        It appears to be the fist time Wicket.Ajax or Wicket.Event occurs.

I also see this error which doesn't seem to be related to Wicket other than the 
fact that it disappears when I reload.

        Uncaught ReferenceError: $ is not defined
        at MyPageForm-ver-68914D2B0F86742C02F38FA95791B4BD.js:445

        This is the line:

        $(document).ready(function() { ... }



-----Original Message-----
From: Martin Grigorov <mgrigo...@apache.org> 
Sent: Thursday, October 21, 2021 1:21 AM
To: users@wicket.apache.org
Subject: Re: ContextRelativeResourceReference CSS rendering problem

CAUTION: This email originated from outside of NISC or its subsidiaries. Do not 
click links or open attachments unless you recognize the sender and know the 
content is safe.


Hi,

On Thu, Oct 21, 2021 at 1:15 AM Greg Dunn <greg.d...@nisc.coop> 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.
>
>

Reply via email to