Merge pull request #10371 from overleaf/jpa-pdf-caching-disable-in-opera

[web] pdf-caching: disable pdf-caching in Opera browser

GitOrigin-RevId: 8c0cefc4fa4fccd74c58649c000be14643788514
This commit is contained in:
Jakob Ackermann 2022-11-08 14:38:43 +00:00 committed by Copybot
parent 381cdf34ce
commit aeade59677

View file

@ -5,8 +5,16 @@ if (!hasTextEncoder) {
console.warn('TextEncoder is not available. Disabling pdf-caching.')
}
const isOpera =
Array.isArray(navigator.userAgentData?.brands) &&
navigator.userAgentData.brands.some(b => b.brand === 'Opera')
if (isOpera) {
console.warn('Browser cache is limited in Opera. Disabling pdf-caching.')
}
function isFlagEnabled(flag) {
if (!hasTextEncoder) return false
if (isOpera) return false
return getMeta('ol-splitTestVariants')?.[flag] === 'enabled'
}