save-data
save-data copied to clipboard
Implement SaveData JavaScript API
Implement the following when dom.netinfo.enabled is flipped to true in Firefox beta
if ('connection' in navigator && navigator.connection.saveData === undefined)
{
navigator.connection.saveData = true;
navigator.connection.dispatchEvent(new Event('change'));
}
Work on the Network Information API was discontinued in 2014 and Firefox is unlikely to implement it. Google keeps recommending it to this day, however.
The following content script would partially implement it. However, this may cause more problems than it's worth as the rest of the Network Information API isn't implemented here.
let netinfo = navigator.connection || (navigator.connection = {});
netinfo.saveData = true;
if (netinfo.dispatchEvent)
netinfo.dispatchEvent(new Event('change'));
Technically it should be proibably implemented as:
Object.defineProperty(navigator.connection, "saveData", { get: function() { return true; } });