Defer loading and parsing of PrimeFaces JavaScript files

Use <o:deferredScript> Yes, it is possible with the <o:deferredScript> component which is new since OmniFaces 1.8.1. For the technically interested, here’s the involved source code: The UI component: DeferredScript The HTML renderer: DeferredScriptRenderer The JS helper: deferred.unminified.js Basically, the component will during the postAddToView event (thus, during the view build time) via UIViewRoot#addComponentResource() add itself … Read more

CSS delivery optimization: How to defer css loading?

If you don’t mind using jQuery, here is a simple code snippet to help you out. (Otherwise comment and I’ll write a pure-js example function loadStyleSheet(src) { if (document.createStyleSheet){ document.createStyleSheet(src); } else { $(“head”).append($(“<link rel=”stylesheet” href=””+src+” />”)); } }; Just call this in your $(document).ready() or window.onload function and you”re good to go. For #2, … Read more