You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@wicket.apache.org by Stepan Samarin <ss...@discovergy.com> on 2021/08/06 12:52:39 UTC

Cookiebot support

Hello,

I'm trying to integrate Cookiebot and am facing the following problem:
<script> element of cookiebot has to be the first item in the <head>
section, otherwise things don't work properly(see
https://support.cookiebot.com/hc/en-us/community/posts/360007744680-Cookiebot-blocks-every-script-on-website
if you're interested).

We have a bunch of stuff added in `renderHead(IHeaderResponse response)`
methods and they get in front of cookiebot <script>, which I'm adding later
in `onInitialize` with WebMarkupContainer.

So, to get cookiebot as the first element in the head section: I thought of
using `JavaScriptHeaderItem` in the `renderHead` method, but it doesn't
seem to support attributes. Cookiebot requires the following attributes in
<script>: `data-cbid` and `data-blockingmode`.

Any ideas?

We're using Wicket 8.12.0.

Regards, Stepan Samarin.

Re: Cookiebot support

Posted by Martin Grigorov <mg...@apache.org>.
Hi,

One more thing.

On Fri, Aug 6, 2021 at 3:53 PM Stepan Samarin <ss...@discovergy.com> wrote:

> Hello,
>
> I'm trying to integrate Cookiebot and am facing the following problem:
> <script> element of cookiebot has to be the first item in the <head>
>

Use <wicket:header-items/> to control the position of the header
contributions. Reead
https://ci.apache.org/projects/wicket/guide/9.x/single.html#_header_contributors_positioning
for more.

section, otherwise things don't work properly(see
>
> https://support.cookiebot.com/hc/en-us/community/posts/360007744680-Cookiebot-blocks-every-script-on-website
> if you're interested).
>
> We have a bunch of stuff added in `renderHead(IHeaderResponse response)`
> methods and they get in front of cookiebot <script>, which I'm adding later
> in `onInitialize` with WebMarkupContainer.
>
> So, to get cookiebot as the first element in the head section: I thought of
> using `JavaScriptHeaderItem` in the `renderHead` method, but it doesn't
> seem to support attributes. Cookiebot requires the following attributes in
> <script>: `data-cbid` and `data-blockingmode`.
>
> Any ideas?
>
> We're using Wicket 8.12.0.
>
> Regards, Stepan Samarin.
>

Re: Cookiebot support

Posted by Bas Gooren <ba...@iswd.nl>.
Hi Stepan,

I would say a combination of two things:

a) subclass JavascriptContentHeaderItem, override its render method to
render additional attributes
b) wrap your new header item in a PriorityHeaderItem

Met vriendelijke groet,
Kind regards,

Bas Gooren

Op 6 augustus 2021 bij 14:53:01, Stepan Samarin (ss@discovergy.com) schreef:

Hello,

I'm trying to integrate Cookiebot and am facing the following problem:
<script> element of cookiebot has to be the first item in the <head>
section, otherwise things don't work properly(see
https://support.cookiebot.com/hc/en-us/community/posts/360007744680-Cookiebot-blocks-every-script-on-website
if you're interested).

We have a bunch of stuff added in `renderHead(IHeaderResponse response)`
methods and they get in front of cookiebot <script>, which I'm adding later
in `onInitialize` with WebMarkupContainer.

So, to get cookiebot as the first element in the head section: I thought of
using `JavaScriptHeaderItem` in the `renderHead` method, but it doesn't
seem to support attributes. Cookiebot requires the following attributes in
<script>: `data-cbid` and `data-blockingmode`.

Any ideas?

We're using Wicket 8.12.0.

Regards, Stepan Samarin.