Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

Deferring contexthub.kernel.js

Avatar

Avatar
Validate 1
Level 2
atyaf66
Level 2

Likes

10 likes

Total Posts

17 posts

Correct Reply

4 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile

Avatar
Validate 1
Level 2
atyaf66
Level 2

Likes

10 likes

Total Posts

17 posts

Correct Reply

4 solutions
Top badges earned
Validate 1
Boost 5
Boost 3
Boost 10
Boost 1
View profile
atyaf66
Level 2

18-06-2018

AEM version: 6.3.2.0

We are in the middle of making performance optimization on our site, as such we are deferring any and all JS scripts with `defer` attributes to prevent scripts from render-blocking. We are using contexthub so naturally, we see the following script:

<script src="/etc/cloudsettings/default/contexthub.kernel.js" type="text/javascript"></script>

We want to add the `defer` attribute to that script; looking at the JSP the renders this script: /libs/granite/contexthub/components/contexthub/contexthub.jsp we see that the only option is to overlay that JSP, which is not a great option especially if Adobe makes changes to that JSP in future releases.

Here are my questions:

  1. Are there any drawbacks to deferring contexthub.kernel.js? I.e. is it render-blocking for a good reason?
  2. I see that the contexthub.kernel.js has dependencies on other code like Granite.HTTP.externalize and I see in the codebase that those dependencies are included in a different clientlib. How are those dependencies included usually? I could not find any documentation around that. I assume that script should be dependency-free since it already includes jQuery and other stuff.

Any help is greatly appreciated. Thank you!

Replies

Avatar

Avatar
Validate 1
Level 4
raghavc
Level 4

Likes

63 likes

Total Posts

61 posts

Correct Reply

19 solutions
Top badges earned
Validate 1
Give Back 5
Give Back 3
Give Back
Boost 50
View profile

Avatar
Validate 1
Level 4
raghavc
Level 4

Likes

63 likes

Total Posts

61 posts

Correct Reply

19 solutions
Top badges earned
Validate 1
Give Back 5
Give Back 3
Give Back
Boost 50
View profile
raghavc
Level 4

20-05-2019

atyaf66​ Did you manage to use async / defer the contexthub javascript ?

Avatar

Avatar
Give Back 5
Employee
Andrew_Khoury
Employee

Likes

75 likes

Total Posts

93 posts

Correct Reply

33 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile

Avatar
Give Back 5
Employee
Andrew_Khoury
Employee

Likes

75 likes

Total Posts

93 posts

Correct Reply

33 solutions
Top badges earned
Give Back 5
Give Back 3
Give Back 10
Give Back
Boost 50
View profile
Andrew_Khoury
Employee

20-05-2019

atyaf66​ and raghavc​ if possible, please open a support case with our AEM support team.  We can ask the Adobe engineering team why the contexthub kernel is loaded synchronously and if there is any optimization that can be done.

Avatar

Avatar
Validate 1
Level 4
raghavc
Level 4

Likes

63 likes

Total Posts

61 posts

Correct Reply

19 solutions
Top badges earned
Validate 1
Give Back 5
Give Back 3
Give Back
Boost 50
View profile

Avatar
Validate 1
Level 4
raghavc
Level 4

Likes

63 likes

Total Posts

61 posts

Correct Reply

19 solutions
Top badges earned
Validate 1
Give Back 5
Give Back 3
Give Back
Boost 50
View profile
raghavc
Level 4

03-06-2019

Response from Adobe

Loading contexthub script as non render blocking scripts is planned to be part of AEM 6.6 (GRANITE-20288)

Avatar

Avatar
Give Back 3
Level 1
skyisaakash
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Give Back 3
Give Back
Boost 1
View profile

Avatar
Give Back 3
Level 1
skyisaakash
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Give Back 3
Give Back
Boost 1
View profile
skyisaakash
Level 1

12-04-2021

@raghavc is there a service ticket for this feature that we can track it by in AEM release notes?

Avatar

Avatar
Give Back 3
Level 1
skyisaakash
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Give Back 3
Give Back
Boost 1
View profile

Avatar
Give Back 3
Level 1
skyisaakash
Level 1

Like

1 like

Total Posts

4 posts

Correct Reply

0 solutions
Top badges earned
Give Back 3
Give Back
Boost 1
View profile
skyisaakash
Level 1

15-04-2021

It seems like only precompiling and caching was done as part of granite-20288, @raghavc is there another ticket for this issue?