Chrome的开发者工具(Chrome Developer Tools)
Chrome的开发者工具(Chrome Developer Tools)
按F12
https://developer.chrome.com/devtools/index
http://www.w3school.com.cn/html/html_intro.asp
http://www.cnblogs.com/QLeelulu/archive/2011/08/28/2156402.html
下面来分别说下每个Tab的作用
1, Elements标签页
这个就是查看、编辑页面上的元素,包括HTML和CSS:
在元素(Elements)面板中,可以看到整个页面的 DOM 树结构和每个元素的所有属性,同时也可以实时地修改这些元素及其属性,并可以实时看到修改后的效果。
左侧就是对页面HTML结构的查看与编辑,你可以直接在某个元素上双击修改元素的属性,
HTML核心属性
属性 |
值 |
描述 |
classname |
规定元素的类名(classname) |
|
id |
规定元素的唯一 id |
|
style_definition |
规定元素的行内样式(inline style) |
|
text |
规定元素的额外信息(可在工具提示中显示) |
右侧可以对左侧被选元素的样式CSS文件进行查看与编辑修改:
HTML 与CSS的关系:
l HTML只有内容,不能定义格式。
l CSS用来定义 HTML的格式。
可以写在HTML中用style的属性来定义CSS格式
<div class="ofRegFooter" style="float: left; width: 100%; display: block;" id="cid1381627595963">
另一种就是单独写一个.css文件在HTML中引用
<link xmlns="" rel="stylesheet" href="/static/common/css/jquery.ui.core.css" type="text/css">
2,Resources标签页
Resources标签页可以查看到请求的资源情况,包括CSS、JS、图片等的内容,同时还可以查看到存储相关的如Cookies、HTML5的Database和LocalStore等,你可以对存储的内容编辑和删除。
3, Network标签页
Network标签页对于分析网站请求的网络情况、查看某一请求的请求头和响应头还有响应内容很有用,特别是在查看Ajax类请求的时候,非常有帮助。注意是在你打开Chrome开发者工具后发起的请求,才会在这里显示的哦。
点击左侧某一个具体去请求URL,可以看到该请求的详细HTTP请求情况:
The Network panel provides insights into resources that are requested and downloaded over the network in real time. Identifying and addressing those requests taking longer than expected is an essential step in optimizing your page.
The Network panel records information about each network operation in your application, including detailed timing data, HTTP request and response headers, cookies, WebSocket data, and more. The Network panel helps you answer questions about the network performance of your web application, such as:
- Which resource had the slowest time to first byte?
- Which resources took the longest time to load (duration)?
- Who initiated a particular network request?
- How much time was spent in the various network phases for a particular resource?
l Use large resource rows: 有些Column会包含两行值(如Name Path; Status Text; Size Content; Time Latency),选中这个按钮,两行值都会显示,否则只会显示主要的一行。
l Initiator:The object or process that initiated the request. It can have one of the following values:
Parser:Chrome's HTML parser initiated the request.
Redirect:A HTTP redirect initiated the request.
Script:A script initiated the request.
Other:Some other process or action initiated the request, such as the user navigating to a page via a link, or by entering a URL in the address bar.
l Cookies:The number of cookies transferred in the request.
l Size and Content:
Size is the combined size of the response headers (usually a few hundred bytes) plus the response body, as delivered by the server.
Content is the size of the resource's decoded content.If the resource was loaded from the browser's cache rather than over the network, this field will contain the text (from cache).
l Time and Latency:
Time is total duration, from the start of the request to the receipt of the final byte in the response.
Latency is the time to load the first byte in the response.
l Preserve log upon navigation button :new records are appended to the bottom of the table. Otherwise,the current network record log is discarded when you navigate to another page, or reload the current page.
l The Timeline shows the time it took to load each resource, from the start of the HTTP request to the receipt of the final byte of the response.
Each resource loading time is represented as a bar, color-coded according to the resource type. The length of the lighter-shaded part of each bar represents the request's latency, while the length of the darker-shaded part represents the time spent receiving the response data.
It is unique from the others in that, when clicked, it displays a menu of additional sort fields.
Timeline — Sorts by the start time of each network request. This is the default sort, and is the same as sorting by the Start Time option).按照request的开始时间排序。
Start Time — Sorts by the start time of each network request.
Response Time — Sorts by each request's response time.
End Time — Sorts by the time when each request completed.
Duration — Sorts by the total time of each request.
Latency — Sorts by the time between the start of the request and the beginning of the response (also known as the "time to first byte").
l Network resource details
HTTP request and response headers;
l Resource network timing
The Timing tab graphs the time spent on the various network phases involved loading the resource.
Property |
Description |
Proxy |
Time spent negotiating with a proxy server connection. |
DNS Lookup |
Time spent performing the DNS lookup. You want to minimize DNS look ups. |
Blocking |
Time the request spent waiting for an already established connection to become available for re-use. |
Connecting |
Time it took to establish a connection, including TCP handshakes/retries, DNS lookup, and time connecting to a proxy or negotiating a secure-socket layer (SSL). |
Sending |
Time spent sending the request. |
Waiting |
Time spent waiting for the initial response. |
Receiving |
Time spent receiving the response data. |
Script标签页
很明显,这个标签页就是查看JS文件、调试JS代码的
Timeline标签页
注意这个Timeline的标签页不是指网络请求的时间响应情况哦(这个在Network标签页里查看),这个Timeline指的JS执行时间、页面元素渲染时间
时间线(timeline)告诉我们告诉您载入页面的时间究竟花在哪些地方。从加载资源到解析 JavaScript 脚本、计算样式表及页面渲染的所有步骤,您都可以在这里看到它们消耗的时间和内存,但是并没有告诉我们代码运行的时候发生了什么。profiler会告诉我们哪些函数执行时占用了大部分时间。
时间线标签为Chrome所记录下来的内容提供三种类型的视图: 事件、帧和内存
事件/帧视图显示的是花在HTML解析(蓝色部分)、JavaScript渲染(黄色部分)、样式计算(紫色)以及CSS渲染(绿色)等方面的时间。
内存视图是用来寻找内存泄漏的迹象的。
Profiles标签页
这个主要是做性能优化的,包括查看CPU执行时间与内存占用:
profiler会根据花费的时间对JavaScript中的函数进行排序,我们由此可以找出耗时的函数。另外,我们可以通过点击函数名旁边的三角形箭头来查看完整的函数调用栈。
The Profiles panel lets you profile the execution time and memory usage of a web app or page. The Profiles panel includes a few profilers: a CPU profiler, a JavaScript profiler and a Heap profiler. These help you to understand where resources are being spent, and so help you to optimize your code:
- The CPU profiler shows where execution time is spent in your page's JavaScript functions.
- The Heap profiler shows memory distribution by your page's JavaScript objects and related DOM nodes.
- The JavaScript profile shows where execution time is spent in your scripts
Audits标签页
这个对于优化前端页面、加速网页加载速度很有用哦(相当与Yslow):
Console标签页
就是Javascript控制台了:
这个除了查看错误信息、打印调试信息(console.log())、写一些测试脚本以外,还可以当作Javascript API查看用。
例如我想查看console都有哪些方法和属性,我可以直接在Console中输入"console"并执行:
Chrome的开发者工具(Chrome Developer Tools)的更多相关文章
- 浏览器开发者工具Chrome Developer Tool
开发者工具Chrome Developer Tool https://developers.google.com/chrome-developer-tools/docs/profiles 一直被墙 ...
- Chrome/谷歌开发者工具分析
Chrome/谷歌开发者工具还是要好好掌握一下,对于前端开发超级有用:https://developers.google.com/web/tools/chrome-devtools/ 1.js内存使用 ...
- 谷歌Chrome浏览器开发者工具的基础功能
上一篇我们学习了谷歌Chrome浏览器开发者工具的基础功能,下面介绍的是Chrome开发工具中最有用的面板Sources.Sources面板几乎是最常用到的Chrome功能面板,也是解决一般问题的主要 ...
- Mac下safari、chrome打开开发者工具快捷键
mac下safari和chrome打开开发者工具的快捷键相同,都是option(alt)+command+i 这个是我的默认配置,没有更改过的.
- 通过使用Chrome的开发者工具来学习JavaScript
本文作者是Peter Rybin,Chrome开发者工具团队成员. 本文中,我们将通过使用Chrome的开发者工具,来学习JavaScript中的两个重要概念”闭包”和”内部属性”. 闭包 首先要讲的 ...
- 爬虫 Http请求,urllib2获取数据,第三方库requests获取数据,BeautifulSoup处理数据,使用Chrome浏览器开发者工具显示检查网页源代码,json模块的dumps,loads,dump,load方法介绍
爬虫 Http请求,urllib2获取数据,第三方库requests获取数据,BeautifulSoup处理数据,使用Chrome浏览器开发者工具显示检查网页源代码,json模块的dumps,load ...
- chrome浏览器开发者工具使用教程[转]
转自:http://www.cr173.com/html/16930_1.html 更多资源:https://developers.google.com/chrome-developer-tools/ ...
- [转]谷歌Chrome浏览器开发者工具教程—JS调试篇
来源:http://blog.csdn.net/cyyax/article/details/51242720 上一篇我们学习了谷歌Chrome浏览器开发者工具的基础功能,下面介绍的是Chrome开发工 ...
- [转]谷歌Chrome浏览器开发者工具教程—基础功能篇
来源:http://www.xiazaiba.com/jiaocheng/5557.html Chrome(F12开发者工具)是非常实用的开发辅助工具,对于前端开发者简直就是神器,但苦于开发者工具是英 ...
随机推荐
- Linux 进程与信号的概念和操作
进程 主要参考: http://www.bogotobogo.com/Linux/linux_process_and_signals.php 信号与进程几乎控制了操作系统的每个任务. 在shell中输 ...
- Emgu.CV(一)
由于这块的知识不少,会分好几期写完 什么是OpenCV? OpenCV是一个基于(开源)发行的跨平台计算机视觉库,可以运行在Linux.Windows和Mac OS操作系统上.它轻量级而且高效--由一 ...
- YYHS-string(线段树)
题解 这道题给你两个操作,一个升序,一个降序 我们可以观察到这个字符串都是由小写字母组成的,只有26个字符,所以我们开一个26个字符的线段树 每次查询的时候找到这个区间内'a'到'z'的数量,再判断一 ...
- 进程池与线程池(concurrent.futures)
from concurrent.futures import ProcessPoolExecutor import os,time,random def task(n): print('%s is r ...
- configparser模块(拷贝)
该模块适用于配置文件的格式与windows ini文件类似,可以包含一个或多个节(section),每个节可以有多个参数(键=值). 创建文件 来看一个好多软件的常见文档格式如下: [DEFAULT] ...
- Eratosthenes,筛法求素数
//筛法求区间[0,n]的所有素数,v为素数表 //v[i]==0,i为素数 void f(int n) { int m=sqrt(n+0.5); memset(v,,sizeof(v)); ;i&l ...
- Python读取SQLite文件数据
近日在做项目时,意外听说有一种SQLite的数据库,相比自己之前使用的SQL Service甚是轻便,在对数据完整性.并发性要求不高的场景下可以尝试! 1.SQLite简介: SQLite是一个进程内 ...
- 浏览器缓存相关HTTP头部字段
1.Cache-Control/Pragma 2.Expires 3.Last-Modified/Etag
- opencv之从视频帧中截取图片
最近在训练一个人脸识别的模型,而项目训练需要大量真实人脸图片样本. 刚好项目用到opencv识别人脸,可以把每一帧图片保存下来,用此方法可以方便的获取大量的脸部样本,大约20分钟可以获取到10000张 ...
- abapGit简介与教程
你是ABAP开发者?你用abapGit吗? 看到这个问题,读者也许会想,什么是abapGit?就让我们从这个问题开始.简单地说,abapGit是一个以ABAP写成为ABAP服务的Git客户端. 有的读 ...