我需要速度提高我webpage.I读了很多关于使用async
和defer
attribute
用于提高初始页speed.All的js
脚本略高于</body>
tag.Please定义的建议如何有效地在我的页面中使用这些属性?通过异步提高网页加载速度和延迟属性
<html>
<head>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.5.0/css/font-awesome.min.css">
<link rel="stylesheet" href="/static/css/style/mystyle.css">
</head>
<body>
<!--HTML content-->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular-touch.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.10/angular-cookies.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/angular-ui-bootstrap/0.11.0/ui-bootstrap-tpls.min.js"></script>
<script src = "https://ajax.googleapis.com/ajax/libs/angularjs/1.2.0/angular-route.min.js"></script>
google analytics script
</body>
</html>
我的问题是如何有效地在这种情况下添加这些属性?我已经定义了所有js脚本在body标签的末尾。所以使用异步或延迟对页面速度产生任何显着影响 –
是否最好为Google分析代码使用异步? –
@akhilviswam是的。您可以。但要小心,并测试自己,如果所有的东西都在工作...... –