[英]Remove Render Blocking Javascript
我尝试使用Google PageSpeed Insights检查我的网站速度有多好! 但它在移动版本中显示错误。 Google建议我删除阻止渲染的javascript,以使我的网站在移动设备上看起来更好。 我已经在下面写下他们到底对我说了什么。
您的页面有1个阻止脚本资源和3个阻止CSS资源。 这会导致页面渲染延迟。
如果不等待以下资源加载,则无法呈现页面上的首屏内容。 尝试延迟或异步加载阻塞资源,或直接在HTML中内联这些资源的关键部分。 删除阻止渲染的JavaScript:
https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js
优化以下CSS交付:
http://fonts.googleapis.com/…%3A300%2C400%7CRaleway%3A400%2C500%2C900 https://www.blogger.com/…/3728782508-widget_css_mobile_bundle.css https://www.blogger.com/…&zx=88195f1c-da8c-4c99-bb3e-609abb88c4fa
如果您编写的页面依赖于在加载时使用jquery,则删除它意味着您将不得不重新编写大量代码,以节省大约10毫秒的加载时间?
打开浏览器的调试器,查看“网络”选项卡,然后重新加载页面。 您应该能够决定建议的优化是否值得(我建议这样做不值得)。
我在使用Javascript时遇到了类似的问题。 确保在源Java之后的代码中放置type =“ text / js”。 像这样: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js" type="text/js"></script>
否则,您需要进入服务器并对htcaccess文件进行调整。
Heloo Nazmul,也许您应该将问题编辑为“如何删除在Blogger中使用Render Blocking Javascript的默认JS和CSS?” 可能会很长,但我认为您的问题就是这样。 按照我的步骤:
<head>
更改为<head>
</head>
之前添加<!-- </head> -->
</head>
</head>
更改为<!--<head/>-->
<!-- </body></html> -->
之前添加<!-- </body></html> -->
</body></html>
关于DOM的工作,如果您仍然感到头疼,我将为您提供示例空白博客模板。
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<meta charset='utf-8'/>
<style/>
<b:skin><![CDATA[]]></b:skin>
<!-- </head> -->
<!--<head/>-->
<body>
<b:section class='header' id='header' showaddelement='yes'/>
<a href="https://klikada.com"><h1 style="color:blue;font-family: monospace">klikada.com</h1></a>
<b:section class='main' id='main' showaddelement='yes'/>
<b:section class='footer' id='footer' showaddelement='yes'/>
<!-- </body></html> -->
<style>a:link{text-decoration:none;}a:visited{text-decoration:none;}a:hover{text-decoration:none;}a:active{text-decoration:underline;}</style>
</body>
</html>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.