In mobile chrome on android device, there is a setting called "Data saving" accessible from Settings > Data saving.
When enabled the behavior can be slightly different when reading media, especially video: on mobile autoplay videos are prohibited except if the video is muted but if data saving is enable muted autoplay isn't allowed anymore.
I would need a way to detect if data saving is used so I can change my video player behavior.
I know that there is a header sent in http requests: "save-data: on" But I don't know any way to read http requests header from javascript.
More info here: https://developer.chrome.com/multidevice/data-compression
Thanks for any answer.
There are some optional window properties that that can be used when doing browser detection. One of them is the optional chrome property (Chromium) and the other the optional opr property (Opera). If a browser has the optional chrome property on the Window object, it means the browser is a Chromium browser.
Opera Mini The browser can save up to 90% of your data when browsing the web. With a revamped look, user-friendly experience, and more functionalities, the latest version of Opera Mini allows you to customize your browse's layout, themes, navigation and more.
Javascript way to detect chrome data saver mode
if('connection' in navigator){
if(navigator.connection.saveData){
console.log(`Your save data mode is = ${navigator.connection.saveData}`)
}else{
console.log(`Your save data mode is = ${navigator.connection.saveData}`)
}
}
For more details follow google developer blog post on Delivering fast and light applications with Save-Data
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With