我有一个html页面,它是由Flask模板返回的,加载需要2分钟,所以我尝试使用Pace.js实现一个进度条。
以下是我的项目结构:
project
-static(folder)
-js(folder)
-pace.js
-css(folder)
-other.css
-dataurl.css
-templates(folder)
-index.html
-run.py(file)index.html
<!doctype html>
<html>
<head>
<title>Popular Flickr Camera</title>
<script language="JavaScript" src="static/js/pace.min.js" />
<link rel="stylesheet" type="text/css" href="static/css/dataurl.css" />
<link rel="stylesheet" type="text/css" href="static/css/style.css" />
</head>
<body>
<table style="width:300px">
<tr>
<th>Rank</th>
<th>Brand</th>
<th>Model</th>
<th>Type</th>
<th>Sensor Resolution</th>
<th>LCD Size</th>
<th>Weight</th>
<th>Lens Mount</th>
</tr>
{% for brand in brands %}
{% for model in brand.models %}
<tr>
<td>{{brand.rank}}</td>
<td>{{brand.name}}</td>
<td>{{model.name}}</td>
<td>{{model.type}}</td>
<td>{{model.resolution}}</td>
<td>{{model.lcd}}</td>
<td>{{model.weight}}</td>
<td>{{model.lens}}</td>
</tr>
{% endfor %}
{% endfor %}
</table>
</body>
</html>Html加载"other.css“芦荟没有问题,
但是在我添加了pace.js资源(pace.min.js和dataurl.css)之后,网站是空白的,控制台中的日志是:
127.0.0.1 - - [12/Feb/2014 11:08:02] "GET / HTTP/1.1" 200 -发布于 2014-02-12 11:04:52
如果它需要2分钟,你可能应该修复它,而不是增加一个拐杖。你的循环不应该是一个缓慢的操作。
也就是说,language是不推荐的,您应该关闭您的<script>标记。
<script type="text/javascript" src="static/js/pace.min.js"></script>是的,这有点奇怪,但是有些浏览器不理解<script />。
我没有找到HTML5语法,但是HTML5 4.1说:
开始标签:必需,结束标签:必需
http://www.w3.org/TR/html401/interact/scripts.html#h-18.2.1
https://stackoverflow.com/questions/21717762
复制相似问题