diff --git a/src/html/_js_base.html.template b/src/html/_js_base.html.template index 7c94ee3fa672..aaa55cbfdcf0 100644 --- a/src/html/_js_base.html.template +++ b/src/html/_js_base.html.template @@ -16,5 +16,9 @@ ) { _ls("/static/polyfills/webcomponents-bundle.js", true); } - var isModern = <%= modernRegex %>.test(navigator.userAgent); + // Modern browsers are detected primarily using the user agent string. + // A feature detection which roughly lines up with the modern targets is used + // as a fallback to guard against spoofs. It should be updated periodically. + var isModern = <%= modernRegex %>.test(navigator.userAgent) && + "findLast" in Array.prototype;