how to see the order of js scripts in a page?
如何查看页面中js脚本的顺序?
I currently see the source html and go through the script declarations. But is there a better way to see the loading order?
我目前看到源html并通过脚本声明。但有更好的方法来查看装载顺序吗?
5 个解决方案
#1
3
You could use Firebug's NET console or the pendants of other developer tools as well. This gives you something like the following:
您也可以使用Firebug的NET控制台或其他开发人员工具的吊坠。这给你类似以下内容:
#2
3
The order of scripts in the html code might not give the exact sequence because there can be situation in which a script is on a remote server and it is down or it is slow. The best way to know is to analyze it visually on a timeline using chrome's in-built developer tool.
html代码中脚本的顺序可能不会给出确切的顺序,因为可能存在脚本在远程服务器上并且它已关闭或速度很慢的情况。最好的方法是使用chrome的内置开发人员工具在时间轴上进行可视化分析。
- Open the page in chrome
- 用chrome打开页面
- Right click and inspect element
- 右键单击并检查元素
- Click Network
- 单击网络
- Refresh the page to get the timeline view.
- 刷新页面以获取时间线视图。
#3
2
Script tags are loaded sequentially in the order they appear.
脚本标记按其出现的顺序依次加载。
This means they are loaded in the order they appear in your HTML, one by one.
这意味着它们按照它们在HTML中出现的顺序逐个加载。
#4
2
Using simply console, try this:
使用简单的控制台,试试这个:
$(function(){
$('script',document).each(function(){
console.log($(this).attr('src') || $(this).text());
});
})
#5
1
Alternatively, you can use the developer tools in chrome or firebug in firefox.
或者,您可以在firefox中使用chrome或firebug中的开发人员工具。
#1
3
You could use Firebug's NET console or the pendants of other developer tools as well. This gives you something like the following:
您也可以使用Firebug的NET控制台或其他开发人员工具的吊坠。这给你类似以下内容:
#2
3
The order of scripts in the html code might not give the exact sequence because there can be situation in which a script is on a remote server and it is down or it is slow. The best way to know is to analyze it visually on a timeline using chrome's in-built developer tool.
html代码中脚本的顺序可能不会给出确切的顺序,因为可能存在脚本在远程服务器上并且它已关闭或速度很慢的情况。最好的方法是使用chrome的内置开发人员工具在时间轴上进行可视化分析。
- Open the page in chrome
- 用chrome打开页面
- Right click and inspect element
- 右键单击并检查元素
- Click Network
- 单击网络
- Refresh the page to get the timeline view.
- 刷新页面以获取时间线视图。
#3
2
Script tags are loaded sequentially in the order they appear.
脚本标记按其出现的顺序依次加载。
This means they are loaded in the order they appear in your HTML, one by one.
这意味着它们按照它们在HTML中出现的顺序逐个加载。
#4
2
Using simply console, try this:
使用简单的控制台,试试这个:
$(function(){
$('script',document).each(function(){
console.log($(this).attr('src') || $(this).text());
});
})
#5
1
Alternatively, you can use the developer tools in chrome or firebug in firefox.
或者,您可以在firefox中使用chrome或firebug中的开发人员工具。