This translation is incomplete. Please help translate this article from English
網路監視器提供檢視所有從 Firefox 送出的網路需求 (像是從瀏覽器開啟一個頁面，或是一個 XMLHttpRequests )，例如需求所花費的時間，以及其他更詳細的資訊。
Opening the Network Monitor
There are a few different ways to open the Network Monitor:
Please note the keyboard shortcut was changed in Firefox 55
- Press Ctrl + Shift + E ( Command + Option + E on a Mac).
- Select "Network" from the Web Developer menu, (which is a submenu in the Tools menu on OS X and Linux).
- Click the wrench icon (), which is in the main toolbar or under the Hamburger menu (), then select "Network".
The Network Monitor will appear at the bottom of the browser window. Reload the page to see the requests:
The Network Monitor records network requests any time the Toolbox is open, even if the Network Monitor itself is not selected. This means you can start debugging a page in, for example, the Web Console, then switch to the Network Monitor to see network activity without having to reload the page.
The UI is divided into four main pieces:
- The main screen contains the toolbar, the network request list, and the network request details pane:
- The performance analysis view is a separate screen:
From Firefox 47 onwards, the toolbar is at the top of the main window. In earlier versions of Firefox, it's at the bottom.
- An icon to clear the network request list.
- An array of icons to filter the network request list by type:
- by the content type of the response
- XHR requests
- (new in Firefox 48) WebSocket upgrades (labeled WS)
- An icon to launch performance analysis.
- A summary of this page, including the number of requests, total size, and total time.
- A box enabling you to filter requests by URL and by properties.
- An icon to show/hide the network request details pane.
Note: From Firefox 58 onwards, the "Flash" filter button is no longer available, and Flash requests are included in the "Others" filter (bug 1413540).
Network request list
By default, the Network Monitor shows a list of all the network requests made in the course of loading the page. Each request is displayed in its own row:
By default, the Network Monitor is cleared each time you navigate to a new page or reload the current page. You can override this behavior by checking "Enable persistent logs" in the Settings.
Network request columns
From Firefox 55 onwards, you can toggle different columns by right-clicking on the table header and choosing the specific column from the context menu. A "Reset Columns" option is also available to reset the columns to their initial configuration. Here is a list of all available columns:
- Status: The HTTP status code returned. This is displayed as a color-coded icon:
- blue circle for informational (1XX codes). Notably, this includes 101 (switching protocols) for WebSocket upgrades.
- green circle for success (2XX codes)
- orange triangle for redirection (3XX)
- red square for errors (4XX and 5XX)
- hollow grey circle for responses that were fetched from the browser cache.
- Method: The HTTP request method used.
- File: The basename of the file requested.
- Protocol: The network protocol used to transfer the data, this column is hidden by default. This is new in Firefox 55.
- Scheme: The scheme (https/http/ftp/...) of the path requested. This column is hidden by default. This is new in Firefox 55.
- Domain: Domain of the path requested.
- If the request used SSL/TLS and the connection had security weaknesses such as weak ciphers, you'll see a warning triangle next to the domain. You will be able to see more details about the problem in the Security tab.
- Hover over the domain to see the IP address.
- There's an icon next to the domain that gives you extra information about the security status of that request. See Security icons.
- Remote IP: The IP address of the server answering the request. This column is hidden by default. This is new in Firefox 55.
- Cause: The reason that the network request occurred, for example XHR request,
<img>, script, script requesting an image, etc. This is new in Firefox 49.
Content-typeof the response.
- Cookies: The number of request cookies associated to the request. This column is hidden by default. This is new in Firefox 55.
- Set-Cookies: The number of response cookies associated to the request. This column is hidden by default. This is new in Firefox 55.
- Transferred: The number of bytes that were actually transferred to load the resource. This will be less than Size if the resource was compressed. From Firefox 47, if the resource was fetched from a service worker cache, then this cell displays "service worker".
- Size: The size of the transferred resource.
The toolbar at the top labels these columns, and clicking the label sorts all the requests by that column.
If the file is an image, the row includes a thumbnail of the image, and hovering over the filename shows a preview in a tooltip:
The Network Monitor displays an icon in the Domain column:
This gives you extra information about the security status of the request:
|Weak HTTPS (for example, a weak cipher was used)|
|Failed HTTPS (for example, a certificate was invalid)|
For weak and failed HTTPS requests, you'll see more details of the problem in the Security tab.
The Cause column indicates what the cause of the request was. This is usually fairly obvious, and you can generally see the correlation between this and the Type column entry. The most common values are:
- document: The source HTML document.
- stylesheet: A CSS file.
You can then click on any of the entries in the popup to open up the relevant script in the Debugger pane.
The request list also displays a timeline for the different parts of each request.
Each timeline is given a horizontal position in its row relative to the other network requests, so you can see the total time taken to load the page. For more details on the color-coding used here, see the section on the Timings page.
Starting in Firefox 45, the timeline also contains two vertical lines:
- The blue line marks the point at which the page's
DOMContentLoadedevent is triggered.
- The red line marks the point at which the page's
loadevent is triggered.
You can filter requests by content type, by whether they are XMLHttpRequests or WebSocket requests, by URL, or by request properties.
Filtering by content type
To filter by content type, use the buttons in the toolbar.
New in Firefox 48
To see only WebSocket connections, use the "WS" button in the toolbar.
To monitor the data exchanged in WebSocket connections, try the WebSocket Monitor add-on.
Filtering by URL
To filter by URL, use the search box in the toolbar. Click in the search box, or press Ctrl + F (or Cmd + F on a Mac), and start typing. The list of network requests will be filtered to include only requests that contain your filter string, in either the Domain or the File portions.
From Firefox 45, you can filter requests that don't contain your filter string by prefixing your query with the "-" operator. For example, the query "-google.com" will show all requests that don't have "google.com" in their URL.
Filtering by properties
New in Firefox 55
To filter by specific request properties, use the search box in the toolbar. The search box recognizes specific keywords, which can be used to filter the requests by specific request properties. Those keywords are followed by a colon and a related filter value. The filter values are matched case insensitive. Prepending a minus (
-) negates the filter. You can combine different filters together by seperating them with a space.
||Shows resources that have the specific HTTP status code.||
||Shows resources that have were requested via the specific HTTP request method.||
||Shows resources coming from a specifc domain.||
||Shows resources coming from a server with the specified IP.||
||Shows resources matching a specific cause type. The types can be found in the description of the cause column.||
||Shows resources having a specific transferred size or a transferred size close to the one specified.
||Shows resources having a specific size (after decompression) or a size close to the one specified.
||Shows resources that are larger than the specified size in bytes.
||Shows resources that match the specified MIME type.||
||Shows resources transferred via the given scheme.||
||Shows resources that contain the specified HTTP response header.||
||Shows the resources that have a
||Shows the resources that have a
||Shows the resources that have a
||Shows the resources having a URL that matches the given regular expression.||
Context-clicking on a row in the list displays a context menu with the following options:
- Copy URL
- Copy URL Parameters (new in Firefox 40)
- Copy POST Data (new in Firefox 40, only for POST requests)
- Copy as cURL
- Copy Request Headers (new in Firefox 40)
- Copy Response Headers (new in Firefox 40)
- Copy Response (new in Firefox 40)
- Copy Image as Data URI (only for images)
- Copy All As HAR (new in Firefox 41)
- Save All As HAR (new in Firefox 41)
- Save Image As (new in Firefox 55, only for images)
- Edit and Resend
- Open in New Tab
- Start Performance Analysis for the page
Edit and Resend
This option opens an editor enabling you to edit the request's method, URL, parameters, and headers, and resend the request.
Open in New Tab
Resends the request in a new tab — very useful for debugging asynchronous requests.
Note: Since Firefox 59, POST requests are correctly resent as POST requests (bug 1220758).
Copy as cURL
This option copies the network request to the clipboard as a cURL command, so you can execute it from a command line. The command may include the following options:
||If the method is not GET or POST|
||For URL encoded request parameters|
||For multipart request parameters|
||If the HTTP version is not 1.1|
||If the method is HEAD|
One for each request header.
From Firefox 34, if the "Accept-Encoding" header is present, the cURL command will include
Copy/Save All As HAR
New in Firefox 41.
These options create an HTTP Archive (HAR) for all requests listed. The HAR format enables you to export detailed information about network requests. 'Copy All As HAR' copies the data to the clipboard, 'Save All As HAR' opens a dialog allowing you to save the archive to disk.
Network request details
Clicking on a row displays a new pane in the right-hand side of the network monitor, which provides more detailed information about the request.
The tabs at the top of this pane enable you to switch between the following pages:
- Security (only for secure pages)
- Stack trace (only when the request has a stack trace, e.g. a script called by another script). This has been available since Firefox 55.
Clicking the icon at the right-hand end of the toolbar closes the details pane and returns you to the list view.
This tab lists basic information about the request:
- Request URL
- Request method
- Remote IP address and port (new in Firefox 39)
- Status code with question mark icon linking to MDN doc for more details (if available)
- The HTTP request and response headers that were sent
- An Edit and Resend button to edit and resend the request
- A Raw headers button to display the raw request and response headers
You can filter the headers that are displayed:
New in Firefox 54
From Firefox 54 onwards, you will see a question mark icon next to each header in the Status code row — this is a link to more information about that particular status code, in the MDN documentation of the HTTP headers.
This tab lists full details of any cookies sent with the request or response:
As with headers, you can filter the list of cookies displayed.
This tab displays the GET parameters and POST data of a request:
The complete content of the response. If the response is HTML, JS, or CSS, it will be shown as text:
If the response is JSON, it will be shown as an inspectable object.
If the response is an image, the tab displays a preview:
From Firefox 59 onwards, if the response is HTML, a preview of the rendered HTML appears inside the Response tab, above the response payload.
The Timings tab breaks a network request down into the following subset of the stages defined in the HTTP Archive specification:
Time spent in a queue waiting for a network connection.
The browser imposes a limit on the number of simultaneous connections that can be made to a single server. In Firefox this defaults to 6, but can be changed using the
|DNS resolution||Time taken to resolve a host name.|
|Connecting||Time taken to create a TCP connection.|
|Sending||Time taken to send the HTTP request to the server.|
|Waiting||Waiting for a response from the server.|
|Receiving||Time taken to read the entire response from the server (or cache).|
It presents a more detailed, annotated, view of the timeline bar for that request showing how the total wait time is split into the various stages:
If the site is being served over HTTPS, you get an extra tab labeled "Security". This contains details about the secure connection used including the protocol, the cipher suite, and certificate details:
The Security tab shows a warning for security weaknesses. Currently it warns you about two weaknesses:
- Using SSLv3 instead of TLS
- Using the RC4 cipher
Since Firefox 55, stack traces are shown in the Stack Trace tab, for responses that have a stack trace of course.
Pausing and resume network traffic recording
In Firefox 58 and above, the Network Monitor has a button that pauses and resumes recording of the current page's network traffic. This is useful in situations where, for example, you are trying to get a stable view of a page for debugging purposes, but under normal circumstances the view keeps evolving due to persistent network requests. The pause button allows you to look at a certain snapshot.
The button can be found at the far left of the main Network Monitor toolbar, and looks like a typical pause button — .
You can see it here in context:
Once pressed, the button changes to a play icon, and you can toggle network traffic recording back on by pressing it again.
The Network Monitor includes a performance analysis tool, to help show you how long the browser takes to download the different parts of your site.
To run the performance analysis tool click the stopwatch icon in the toolbar.
(Alternatively, if you have only just opened the Network Monitor, so it's not yet populated with the list of requests, you'll get a stopwatch icon in the main window.)
The Network Monitor then loads the site twice: once with an empty browser cache, and once with a primed browser cache. This simulates the first time a user visits your site, and subsequent visits. It displays the results for each run side by side, or vertically if the browser window is narrow:
The results for each run are summarised in a table and a pie chart. The tables group resources by type, and show the total size of each resource and the total time it took to load them. The accompanying pie chart shows the relative size of each resource type.
To get back to the Network Monitor's list of network requests click the "Back" button on the left.
Clicking on a slice of the pie takes you to the Network Monitor for that run, with a filter automatically applied to see only that resource type.