[英]Why Google Pagespeed Insights is not updating the score after making changes?
I have a site.我有一个网站。 I tested it in Google Pagespeed Insights and it gave me some suggestions.我在 Google Pagespeed Insights 中对其进行了测试,它给了我一些建议。 I changed the issues.我改变了问题。 I deleted some files.我删除了一些文件。 But it's still showing the same result and giving the same suggestions.但它仍然显示相同的结果并给出相同的建议。 Gtmetrix is showing the changes, but Google Pagespeed Insights is not. Gtmetrix 正在显示更改,但 Google Pagespeed Insights 没有。 Can anyone tell me what is the reason?谁能告诉我是什么原因? Site Link: https://www.galpal.co.uk/网站链接: https://www.galpal.co.uk/
You are getting this error because the file is still referenced in the HTML.您收到此错误是因为 HTML 中仍引用该文件。
Because the browser doesn't know that you have deleted the file off your server it still makes the request as you left a reference to it in your HTML.因为浏览器不知道您已经从服务器上删除了该文件,它仍然会发出请求,因为您在 HTML 中留下了对它的引用。
Even thought the file returns 404 not found there is still a request made for the file.即使文件返回 404 not found 仍然存在对该文件的请求。 At this point that is something that will block rendering of the above the fold content.在这一点上,这将阻止呈现上述折叠内容。
Remove the reference in your HTML (remove the <script>
element referencing the file) and Page Speed Insights will reflect the change.删除 HTML 中的引用(删除引用文件的<script>
元素),Page Speed Insights 将反映更改。
To be clear GT Metrix is wrong here and Page Speed Insights is correct.需要明确的是,GT Metrix 在这里是错误的,而 Page Speed Insights 是正确的。
ps - you should add defer
attribute (or async
but that is more difficult) to your scripts ps - 你应该在你的脚本中添加defer
属性(或async
,但这更难)
<script src="yourJavaScriptFile.js" defer></script>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.