admin管理员组文章数量:1296920
I see the w3c site in navigator.connection.saveData object but I didn't understand what is the use? and where can I use it on my website?
Please anyone can explain me about this.
I see the w3c site in navigator.connection.saveData object but I didn't understand what is the use? and where can I use it on my website?
Please anyone can explain me about this.
Share Improve this question edited Apr 15, 2018 at 6:13 Nisarg Shah 14.6k6 gold badges38 silver badges57 bronze badges asked Apr 15, 2018 at 6:01 Bhautik ChudasamaBhautik Chudasama 7129 silver badges28 bronze badges2 Answers
Reset to default 8According to the Network Information API spec, it looks like saveData
attribute indicates whether the user has requested that data usage be reduced by the user agent:
The
saveData
attribute, when getting, returns true if the user has requested a reduced data usage mode from the user agent, and false otherwise.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.
Regarding your second question,
Where can I use it on my website?
According to MDN (and CanIUse.), navigator.connection
API is currently only supported in Chrome versions 61+. It will not work with other browsers yet.
In fact, according to CanIUse., Chrome only supports the downlink
, effectiveType
& rtt
attributes on navigator.connection
. So you might not be able to use saveData
on Chrome either.
so. navigator.connection.saveData saving data about user connection. Definition of Navigator Connection
The Network Information API provides information about the system's connection in terms of general connection type (e.g., 'wifi', 'cellular', etc.). This can be used to select high definition content or low definition content based on the user's connection. The entire API consists of the addition of the NetworkInformation interface and a single property to the Navigator interface: Navigator.connection.
Example code:
var connection = navigator.connection || navigator.mozConnection || navigator.webkitConnection;
var type = connection.type;
function updateConnectionStatus() {
console.log("Connection type changed from " + type + " to " + connection.type);
}
connection.addEventListener('change', updateConnectionStatus);
本文标签: javascriptWhat is the purpose of navigatorconnectionsaveDataStack Overflow
版权声明:本文标题:javascript - What is the purpose of navigator.connection.saveData? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741640803a2389904.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论