Preloading of static sources like fonts,css, js, image is good, but it is no good idea to use html preload. This tag loads sources too late and doesn’t have any advantage. LiteSpeed webserver supports Server/PUSH feature that makes preloading in response header available. This kind of preloading is much faster and loads sources before any data for response body is loaded.
To prevent preloading on every page request LiteSpeed webserver recognize if there is a preload header. If preload header exists LSWS sets cookie “ls_smartpush” automatically and if this cookie is set preloading sources will only be loaded once and not with each page request. Static sources must not be preloaded with each page request because they are already in browser cache with the first request.
Preload header can be set with PHP or in .htaccess
Example for .htaccess:
RewriteCond %{HTTP_COOKIE} !ls_smartpush [NC]
RewriteRule ^.*$ - [ENV=PRELOAD:true]
Header add Link "</path/to/static/source.woff>; rel=preload;as=font;crossorigin=anonymous,</path/to/static/stylesheet.css>; rel=preload;as=style,</path/to/static/javascript.js>; rel=preload;as=script" env=PRELOAD
Take care of different usage for tags depending on kind of static source:
Fonts: </path/to/static/source.woff>; rel=preload;as=font;crossorigin=anonymous
CSS: </path/to/static/stylesheet.css>; rel=preload;as=style
Javascript: </path/to/static/javascript.js>; rel=preload;as=script
Images: </path/to/static/image.jpg>; rel=preload;as=image
Enjoy! ??
Don’t use any plugin for HTML preload!