Expand my Community achievements bar.

SOLVED

Granite JS and CSS files loaded twice

Avatar

Level 2

When a page (http://localhost:4502/content/geometrixx/en.html) is opened in author mode with content finder, JS and CSS files are loaded twice.

Granite, foundation, personalization JS and CSS files.

e.g /etc/clientlibs/granite/jquery/granite.js

/etc/clientlibs/foundation/shared.js

/etc/clientlibs/foundation/personalization/ui.js) 

Is there any workaround to prevent these files from loading twice.

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi Jitendra,

As far as I know there is no way to avoid it from happening.

First of all let me explain you why it happens:

  •  When you load the page with contentfinder then your actual page gets loaded in iframe, so if you access URL - localhost:4502/cf#/content/geometrixx/en.html then content/geometrixx/en.html is loaded in a separate iframe in your page document (You can validate that using firebug).
  •  Now when you load content finder the HTML gets rendered from following script - /libs/cq/ui/components/widget/html.jsp
  •  This HTML will load its own set of clientlib categories defined on node - /libs/wcm/core/content/contentfinder with property jsLibs and then using extjs is creates IFrame on the fly using the page path accessed.
    • the value present right now is cq.wcm.edit
  • cq.wcm.edit further includes all the other libraries and their respective js/css that you are seeing twice (You can validate that using dumplib url - http://localhost:4502/libs/granite/ui/content/dumplibs.html?categories=cq.wcm.edit&type=JS&theme=, see the snapshot below)
  • [img]cq.wcm.edit.jpg[/img]
  • And finally since the page is actually loaded via Iframe, it again injects its own clientlibs defined in its head section (go to firebug HTML console and search for head tag, you should see two head tags present)

 Thanks
 Runal

View solution in original post

3 Replies

Avatar

Correct answer by
Community Advisor

Hi Jitendra,

As far as I know there is no way to avoid it from happening.

First of all let me explain you why it happens:

  •  When you load the page with contentfinder then your actual page gets loaded in iframe, so if you access URL - localhost:4502/cf#/content/geometrixx/en.html then content/geometrixx/en.html is loaded in a separate iframe in your page document (You can validate that using firebug).
  •  Now when you load content finder the HTML gets rendered from following script - /libs/cq/ui/components/widget/html.jsp
  •  This HTML will load its own set of clientlib categories defined on node - /libs/wcm/core/content/contentfinder with property jsLibs and then using extjs is creates IFrame on the fly using the page path accessed.
    • the value present right now is cq.wcm.edit
  • cq.wcm.edit further includes all the other libraries and their respective js/css that you are seeing twice (You can validate that using dumplib url - http://localhost:4502/libs/granite/ui/content/dumplibs.html?categories=cq.wcm.edit&type=JS&theme=, see the snapshot below)
  • [img]cq.wcm.edit.jpg[/img]
  • And finally since the page is actually loaded via Iframe, it again injects its own clientlibs defined in its head section (go to firebug HTML console and search for head tag, you should see two head tags present)

 Thanks
 Runal

Avatar

Level 2

We are using AEM Version 5.6.1.20130606