javascript 如何禁用 Chrome 开发者工具自动网络录制?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24412051/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-28 02:44:38  来源:igfitidea点击:

How to disable chrome developer tools automatic network recording?

javascriptgoogle-chromenetworking

提问by Alexandre

In chrome developer tools, every time a page loads I click on "Network" tab and see the "record" button active / red. Even if I disable the recording of network traffic, when I refresh the same page or open another website I see that Chrome is recording traffic in the "Network" tab.

在 Chrome 开发人员工具中,每次加载页面时,我都会单击“网络”选项卡并看到“记录”按钮处于活动状态/红色。即使我禁用了网络流量记录,当我刷新同一页面或打开另一个网站时,我也会看到 Chrome 正在“网络”选项卡中记录流量。

When developing big web applications that have A LOT of traffic - 3rd party apis, statics CDNs from Amazon, Google and all the app's assets that must be downloaded like images, js files, css files, etc etc - this "Network" tab works very slowly and my browser gets stuck a lot. This causes my development time to be less productive because I must wait every time I want to check something in the "Networks" tab.

在开发具有大量流量的大型 Web 应用程序时 - 3rd 方 api、来自亚马逊、谷歌的静态 CDN 以及必须下载的所有应用程序资产,如图像、js 文件、css 文件等 - 这个“网络”选项卡非常有效慢慢地,我的浏览器卡住了很多。这导致我的开发时间效率较低,因为每次我想在“网络”选项卡中检查某些内容时都必须等待。

Can I turn the recording off by default? Can the "Record" button be grey and when I want it to start recording I just click on it and start seeing the traffic?

我可以默认关闭录音吗?“记录”按钮可以是灰色的,当我想要它开始记录时,我只需点击它并开始查看流量吗?

回答by Marcel Burkhard

I don't know of an option to turn off the default recoding BUT you can do the following:

我不知道关闭默认重新编码的选项,但您可以执行以下操作:

  1. Open a new empty tab
  2. Hit F12
  3. Disable Network Recording
  4. Paste the url of your application to the adressbar
  1. 打开一个新的空标签
  2. 按 F12
  3. 禁用网络录制
  4. 将您的应用程序的 url 粘贴到地址栏

This way you don't have to load the page once before disabling network recording, which is your problem from what I understand, because you have a lot of resources loading.

这样你就不必在禁用网络录制之前加载一次页面,根据我的理解,这是你的问题,因为你有很多资源加载。

回答by AlexioVay

2018 solution: The only thing that works for me is opening this page:

2018 解决方案:唯一对我有用的是打开此页面:

chrome://serviceworker-internals/

chrome://serviceworker-internals/

And then Unregisterand Stopall workers there.

然后UnregisterStop那里的所有工人。

回答by Jason

By default, it's not recording anything until you have the F12 tools open (even though the circle is red when you first open it). If you don't have the F12 tools open, it won't record the history. When you first open it, if you notice at the bottom, it tells you that nothing has been cached, and refresh the page if you want to see the network traffic. If, when you open the F12 tools, your site is still doing a lot of traffic, it'll start reporting it at that point, but nothing prior.

默认情况下,在您打开 F12 工具之前它不会记录任何内容(即使第一次打开时圆圈是红色的)。如果你没有打开 F12 工具,它不会记录历史。当你第一次打开它时,如果你注意到底部,它会告诉你没有缓存任何东西,如果你想查看网络流量,请刷新页面。如果当您打开 F12 工具时,您的站点仍然有大量流量,它会在那时开始报告它,但不会事先报告。

I'm pretty dubious that it's the source of your slow-down. It's really just capturing all the HTTP traffic and saving the request/responses, it's not a lot of work, very little in fact. The resources/profiles/timelines parts that canbe more consuming are all off by default.

我很怀疑这是你减速的根源。它实际上只是捕获所有 HTTP 流量并保存请求/响应,这不是很多工作,实际上很少。默认情况下,可能更消耗的资源/配置文件/时间线部分全部关闭。

This is opening F12 tools right after Reddit has finished loading

这是在 Reddit 完成加载后立即打开 F12 工具

回答by JGibbers

There's a button in the top left of the Network Panel. It looks like a little red circle, you can hit that to stop recording network events.

网络面板的左上角有一个按钮。它看起来像一个小红圈,你可以点击它停止记录网络事件。

I just disabled it, refreshed this page and saw nothing in there. Is something like that what you were looking for?

我只是禁用了它,刷新了这个页面,却什么也没看到。你要找的东西是这样的吗?