惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Vercel News
Vercel News
O
OpenAI News
Engineering at Meta
Engineering at Meta
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
月光博客
月光博客
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
GbyAI
GbyAI
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
B
Blog RSS Feed
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
云风的 BLOG
云风的 BLOG
罗磊的独立博客
S
SegmentFault 最新的问题
The Register - Security
The Register - Security
Hugging Face - Blog
Hugging Face - Blog
D
DataBreaches.Net
U
Unit 42
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
B
Blog
阮一峰的网络日志
阮一峰的网络日志
P
Proofpoint News Feed
雷峰网
雷峰网
V
Visual Studio Blog
小众软件
小众软件
aimingoo的专栏
aimingoo的专栏
N
Netflix TechBlog - Medium
酷 壳 – CoolShell
酷 壳 – CoolShell
H
Hackread – Cybersecurity News, Data Breaches, AI and More
Y
Y Combinator Blog
博客园 - 【当耐特】
G
Google Developers Blog
L
LangChain Blog
Stack Overflow Blog
Stack Overflow Blog
I
InfoQ
Martin Fowler
Martin Fowler
F
Fortinet All Blogs
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Cloudflare Blog
AI
AI
Google Online Security Blog
Google Online Security Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
博客园 - Franky
Blog — PlanetScale
Blog — PlanetScale
Webroot Blog
Webroot Blog
PCI Perspectives
PCI Perspectives
爱范儿
爱范儿
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org

Recent Commits to netinfo:gh-pages

chore: enable MDN + config cleanup · WICG/netinfo@7922967 chore: In the Browser Support table, show Android Firefox (#86) Merge pull request #83 from yoavweiss/cleanup Remove Save-Data and reference Client Hints Update w3c.json Use [SameObject] for navigator.connection IDL (#79) Remove extended attributes on mixin · WICG/netinfo@60dd214 Markdown cleanup Move Marcos to former editor. Added example about offline mode (#75) · WICG/netinfo@a241166 first attempt at addressing #71 (#73) · WICG/netinfo@f759683 Update index.html (#72) Move ferjm to the former editors section (#70) define RTT, Downlink, ECT request header fields (#69) Revamp of the "Requirements and use cases" section. (#65) use application RTT/throughput for NQE (#62) call out same+cross-origin exposure in privacy section clarify how rtt & downlink are determined (#57) Merge pull request #54 from WICG/threshold
add saveData attribute to NetworkInformation (#66) · WICG/netinfo@10fdd2d
igrigorik · 2017-10-03 · via Recent Commits to netinfo:gh-pages

@@ -297,6 +297,7 @@

297297

readonly attribute Megabit downlinkMax;

298298

readonly attribute Megabit downlink;

299299

readonly attribute Millisecond rtt;

300+

readonly attribute boolean saveData;

300301

attribute EventHandler onchange;

301302

};

302303332333333334

The `rtt` attribute represents the effective round-trip time estimate in <dfn data-lt="Millisecond">milliseconds</dfn>, rounded to nearest multiple of 25 milliseconds, and is based on recently observed application-layer RTT measurements across recently active connections, excluding connections made to private address space [[!RFC1918]]. In absence of recent RTT measurement data, the attribute value is determined by the properties of the <a>underlying connection technology</a>.

334335336+

### <dfn>saveData</dfn> attribute

337+338+

The `saveData` attribute, when getting, returns `true` if the user has requested a reduced data usage mode from the user agent, and `false` otherwise.

339+340+

<p class="note">The user may enable such preference, if made available by the user agent, due to high data transfer costs, slow connection speeds, or other reasons.</p>

341+342+

<section>

343+

#### Save-Data (Client Hint) Request Header Field

344+345+

The “Save-Data” request header field consists of one or more tokens that indicate user agent's preference for reduced data usage.

346+347+

<pre class="highlight">

348+

Save-Data = sd-token *( OWS ";" OWS [sd-token] )

349+

sd-token = token

350+

</pre>

351+352+

This specification defines the "`on`" `sd-token` value, which is used as a signal indicating explicit user opt-in into a reduced data usage mode (i.e. when <a>saveData</a>'s value is `true`), and when communicated to origins allows them to deliver alternate content honoring such preference - e.g. smaller image and video resources, alternate markup, and so on.

353+354+

If Save-Data occurs in a message more than once, the last value overrides all previous occurrences.

355+356+

<p class="issue">TODO: update <a href="https://fetch.spec.whatwg.org/#fetching">Fetch#fetching algorithm</a> to use `connection.saveData` as signal to append the Save-Data header.</p>

357+

</section>

335358

</section>

336359337360368391

<section data-link-for="NetworkInformation">

369392

### Handling changes to the underlying connection

370393371-

When the properties of the <a>underlying connection technology</a> change, due to a switch to a different <a>connection type</a> or <a>effective connection type</a>, change in <a>upper bound on the downlink speed of the first network hop</a>, or change in effective <a>downlink</a> or <a>rtt</a> estimates, the user agent MUST run the <dfn>steps to update the connection values</dfn>:

394+

When the properties of the <a>underlying connection technology</a> change, due to a switch to a different <a>connection type</a> or <a>effective connection type</a>, change in <a>upper bound on the downlink speed of the first network hop</a>, change in effective <a>downlink</a> or <a>rtt</a> estimates, or change in <a>saveData</a> preference, the user agent MUST run the <dfn>steps to update the connection values</dfn>:

372395373396

1. Let <var>new-type</var> be the <a>connection type</a> that represents the <a>underlying connection technology</a>.

374397

1. Let <var>new-effective-type</var> be the <a>effective connection type</a> determined by current <a>downlink</a> and <a>rtt</a> values.

398+

1. Let <var>new-saveData</var> be the current <a>saveData</a> preference.

375399

1. Let <var>new-downlink</var> be the result of:

376400

1. Rounding <a>downlink</a> value to nearest multiple of 25 kilobits per second.

377401

1. If the resulting value is 10% greater or smaller than the value of `connection.downlink`, then set <var>new-dowlink</var> to resulting value. Otherwise, set <var>new-downlink</var> to the value of `connection.downlink`.

@@ -382,13 +406,14 @@

382406

1. if <var>new-type</var> is "unknown", set <var>max-value</var> to `+Infinity`.

383407

1. If <var>new-type</var> is "mixed", set <var>max-value</var> to an applicable value for the interface configuration used to service new network requests - e.g. if multiple interfaces may be used, sum their <a>downlinkMax for an available interface</a> values.

384408

1. Otherwise, set <var>max-value</var> to <a>downlinkMax for an available interface</a>.

385-

1. If <var>max-value</var> is not equal to the value of `connection.downlinkMax`, or if <var>new-type</var> is not equal to the value of `connection.type`, or if <var>new-downlink</var> is not equal to the value of `connection.downlink`, or if <var>new-rtt</var> is not equal to the value of `connection.rtt`:

409+

1. If <var>max-value</var> is not equal to the value of `connection.downlinkMax`, or if <var>new-type</var> is not equal to the value of `connection.type`, or if <var>new-downlink</var> is not equal to the value of `connection.downlink`, or if <var>new-rtt</var> is not equal to the value of `connection.rtt`, or if <var>new-saveData</var> is not equal to the value of `connection.saveData`:

386410

1. Using the <a data-cite="!HTML#networking-task-source">networking task source</a>, <a data-cite="!HTML#queue-a-task">queue a task</a> to perform the following:

387411

1. Set `connection.downlinkMax` to <var>max-value</var>.

388412

1. Set `connection.type` to <var>new-type</var>.

389413

1. set `connection.effectiveType` to <var>new-effective-type</var>.

390414

1. Set `connection.downlink` to <var>new-downlink</var>.

391415

1. Set `connection.rtt` to <var>new-rtt</var>.

416+

1. Set `connection.saveData` to <var>new-saveData</var>.

392417

1. <a data-cite="!DOM#concept-event-fire">Fire an event</a> named `change` at the `NetworkInformation` object.

393418

</section>

394419