Chrome DevTools:如何过滤网络请求
As front end developers, most of our time is spent in the browser with DevTools open (almost always, unless we are watching YouTube ... sometimes even then).
作为前端开发人员,我们大部分时间都花在打开DevTools的浏览器中(几乎总是,除非我们正在观看YouTube,有时甚至是那时)。
One of the major sections in DevTools is the
networktab. There are a couple of things you can do in the
networktab, like the following:
DevTools中的主要部分之一是
network选项卡。 您可以在[
network标签中执行以下操作:
- Find network requests by text 通过文本查找网络请求
- Find network requests by regex expression 通过正则表达式查找网络请求
- Filter (exclude) out network requests 过滤(排除)网络请求
- Use the property filter to see network requests by a certain domain 使用属性过滤器查看特定域的网络请求
- Find network requests by resource type 按资源类型查找网络请求
For the purposes of this tutorial I am using freeCodeCamp's home page, freecodecamp.org/news. Simply go to the page and open the
networktab.
就本教程而言,我使用的是freeCodeCamp的主页freecodecamp.org/news 。 只需转到该页面并打开“
network标签。
You can see the
networktab by hitting
cmd + opt + jon your Mac or
ctrl + shift + jin Windows. It will open up the
consoletab in DevTools by default.
您可以通过在Mac上按
cmd + opt + j或在Windows中按
ctrl + shift + j来查看“
network标签。 默认情况下,它将在DevTools中打开
console选项卡。
Once the
consoletab is open, simply click on the
networktab to make it visible.
打开
console选项卡后,只需单击
network选项卡使其可见。
Once the
networktab is open we can begin our tutorial.
打开
network标签后,我们就可以开始我们的教程了。
让我们开始 (Let's begin)
Make sure the correct page is open (freecodecamp.org/news) and the "network" tab panel is open in DevTools:
确保打开了正确的页面( freecodecamp.org/news ),并且在DevTools中打开了“网络”标签面板:
- The green box here illustrates the icon that can hide/show the filter area in the network panel tab. 此处的绿色框说明了可以隐藏/显示“网络面板”选项卡中的过滤器区域的图标。
- The red box here illustrates the filter area box. With this box we can filter out network requests. 这里的红色框说明了过滤区域框。 使用此框,我们可以过滤出网络请求。
通过文字查找网络请求 (Find network request by text)
Type
analyticsinto the Filter text box. Only the files that contain the text
analyticsare shown.
在过滤器文本框中输入
analytics。 仅显示包含文本
analytics的文件。
通过正则表达式查找网络请求 (Find network request by regex expression)
Type
/.*\min.[c]s+$/. DevTools filters out any resources with filenames that end with a
min.cfollowed by 1 or more
scharacters.
/.*\min.[c]s+$/。 DevTools过滤掉所有文件名以
min.c结尾且后跟1个或多个
s字符的资源。
过滤(排除)网络请求 (Filter (exclude) out network request)
Type
-min.js. DevTools filters out all files that contain
min.js. If any other file matches the pattern they will also be filtered out and won't be visible in the network panel.
-min.jsDevTools过滤掉包含
min.js所有文件。 如果任何其他文件与该模式匹配,它们也将被过滤掉,并且在网络面板中将不可见。
使用属性过滤器查看特定域的网络请求 (Use property filter to see network request by a certain domain)
Type
domain:code.jquery.cominto the filter area. It will only show network requests that belong to the URL
code.jquery.com.
在过滤器区域中输入
domain:code.jquery.com。 它只会显示属于URL
code.jquery.com网络请求。
按资源类型查找网络请求 (Find network request by resource type)
If you only want to see which font(s) file is being used on a certain page click
Font:
如果您只想查看特定页面上正在使用哪种字体文件,请点击
Font:
Or if you only want to see the web socket files being loaded on a certain page click
WS:
或者,如果您只想查看特定页面上正在加载的Web套接字文件,请单击
WS:
You can also go one step further and view both
Font&
WSfiles together. Simply click on
Fontfirst and then
cmdclick on
WSto multi-select tabs. (If you are on a Windows machine you can multi-select by using
ctrlclick).
您还可以更进一步,一起查看
Font和
WS文件。 只需先单击“
Font,然后
cmd单击
WS以多选选项卡。 (如果您在Windows计算机上,则可以使用
ctrl单击来进行多选)。
That is it for this tutorial. If you found it useful do share it with your colleagues and let me know what you think as well on twitter.com/adeelibr.
本教程就是这样。 如果您发现它有用,请与您的同事分享,并在twitter.com/adeelibr上告诉我您的想法。
翻译自: https://www.freecodecamp.org/news/chrome-devtools-network-tab-tricks/
- 在文件过滤驱动中如何判断文件访问请求来自网络?
- 黄聪:如何扩展Chrome DevTools来获取页面请求
- 在文件过滤驱动中如何判断文件访问请求来自网络?
- 在文件过滤驱动中如何判断文件访问请求来自网络
- 如何使用ASIHTTPRequest来进行网络请求的
- 如何在Chrome development tool里查看C4C前台发送的请求细节
- App 组件化/模块化之路——如何封装网络请求框架
- 如何书写网络请求框架(先知)
- Xcode如何请求网络并从网络上获得资源
- 国内SEO如何过滤掉不良网络信息
- 如何解决chrome 等浏览器不支持本地ajax请求的问题
- iOS在页面销毁时如何优雅的cancel网络请求详解
- angular 请求网络数据 展示table 查询关键字 过滤 删除 添加 修改
- IOS-如何处理多个网络请求的并发的情况
- 如何抓取手机请求的网络包【转】
- 如何让chrome支持本地Ajax请求。
- 如何用好 Chrome devtools
- 非常好用的网络请求调试工具(chrome postman)
- 如何在chrome中安装Vue调试神器vue-devtools
- Chrome扩展及应用开发 入门笔记(六)进阶(网络请求,脚本注入)