pagespeed

How to parallelize downloads across hostnames on WordPress?

痞子三分冷 提交于 2020-01-13 11:15:22
问题 I'm getting this message "Parallelize downloads across hostnames" when checking my WordPress site on GTmetrix > https://gtmetrix.com Here are the details > https://gtmetrix.com/parallelize-downloads-across-hostnames.html How do I fix that ? 回答1: Details Web browsers put a limit on the number of concurrent connections they will make to a host. When there are many resources that need to be downloaded, a backlog of resources waiting to be downloaded will form. The browser will make up as many

How to parallelize downloads across hostnames on WordPress?

安稳与你 提交于 2020-01-13 11:15:01
问题 I'm getting this message "Parallelize downloads across hostnames" when checking my WordPress site on GTmetrix > https://gtmetrix.com Here are the details > https://gtmetrix.com/parallelize-downloads-across-hostnames.html How do I fix that ? 回答1: Details Web browsers put a limit on the number of concurrent connections they will make to a host. When there are many resources that need to be downloaded, a backlog of resources waiting to be downloaded will form. The browser will make up as many

Loading external javascript via async script tag at the end of a webpage

怎甘沉沦 提交于 2020-01-09 11:59:25
问题 Loading external javascript via async script tag at the end of a webpage I'm trying to find out what is the best way to load javascript in terms of page speed. Let's take this example: FILE.JS: // Synchronous delay of 5 seconds var timeWhile = new Date().getTime(); while( new Date().getTime() - timeWhile < 5000 ); And FILE.HTML: <!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title>Test</title> </head> <body> SOME HTML <script src="file.js" async></script> </body> </html> Now do the

Load jquery core asynchronous with fallback

假装没事ソ 提交于 2020-01-03 17:16:10
问题 With performance optimization and non-blocking scripts in header, I've been trying to asynchronously load the jquery itself. I ran into a jQuery Loader script, that async loads jquery and thereafter catches and queues jquery document ready calls. This seems to work most of the time, but not always. So I created a fallback to load a local jquery version if the loader hasn't finished within x seconds. The fallback works, but not completely. Some parts may work, others not. Script so far called

Defer unused CSS

跟風遠走 提交于 2020-01-03 01:34:07
问题 I have a critcal CSS process in place that prevents a flash-of-unstyled-content (FOUC) on above-the-fold content of a page. I'm stuck on 'defer unused CSS' point that's being highlighted by Google PageSpeed insights (lighthouse) and/or Chrome's Performance Audit. I've gone through other articles but they do not work. To summarize I've tried so far. loadCSS() A script that uses requestAnimationFrame Ref: CSS delivery optimization: How to defer css loading? If I delay loading the script via

Ultimate solution to defer javascript and jquery after page is loaded

断了今生、忘了曾经 提交于 2020-01-01 18:56:54
问题 As you probably know, Google PageSpeed Insights wants you to defer your javascript. Google itself suggests a solution to defer your code: <script type="text/javascript"> function downloadJSAtOnload() { var element = document.createElement("script"); element.src = "deferredfunctions.js"; document.body.appendChild(element); } if (window.addEventListener) window.addEventListener("load", downloadJSAtOnload, false); else if (window.attachEvent) window.attachEvent("onload", downloadJSAtOnload);

How to compress HTTP response headers?

左心房为你撑大大i 提交于 2019-12-30 09:56:29
问题 At the Velocity 2010 conference, Google said that header compression can yield big gains: Hölzle noted a glaring inefficiency in the handling of web page headers, which provide information about a user’s IP address, browser and other session data. The average web page makes 44 calls to different resources, with many of those requests including repetitive header data. Holzle said compressing the headers produces an 88 percent page load improvement for some leading sites. How does one ensure

How to Specify “Vary: Accept-Encoding” header in .htaccess

假如想象 提交于 2019-12-29 02:22:23
问题 Google PageSpeed says I should "Specify a Vary: Accept-Encoding header" for JS and CSS. How do I do this in .htaccess? 回答1: I guess it's meant that you enable gzip compression for your css and js files, because that will enable the client to receive both gzip-encoded content and a plain content. This is how to do it in apache2: <IfModule mod_deflate.c> #The following line is enough for .js and .css AddOutputFilter DEFLATE js css #The following line also enables compression by file content

PageSpeed Insights 99/100 because of Google Analytics - How can I cache GA?

不羁岁月 提交于 2019-12-28 01:38:41
问题 I'm on a quest to reach 100/100 on PageSpeed and i'm almost there. I'm trying to find a good solution to cache Google Analytics. Here is the message I get: Leverage browser caching Setting an expiry date or a maximum age in the HTTP headers for static resources instructs the browser to load previously downloaded resources from local disk rather than over the network. Leverage browser caching for the following cacheable resources: http://www.google-analytics.com/analytics.js (2 hours) The only

Possible to defer loading of jQuery?

南楼画角 提交于 2019-12-27 18:21:07
问题 Let's face it, jQuery/jQuery-ui is a heavy download. Google recommends deferred loading of JavaScript to speed up initial rendering. My page uses jQuery to set up some tabs which are placed low on the page (mostly out of initial view) and I'd like to defer jQuery until AFTER the page has rendered. Google's deferral code adds a tag to the DOM after the page loads by hooking into the body onLoad event: <script type="text/javascript"> // Add a script element as a child of the body function