Skip to content

Commit

Permalink
Add fallback feature detection for Array.prototype.findLast
Browse files Browse the repository at this point in the history
  • Loading branch information
steverep committed Jul 16, 2024
1 parent 8a524da commit 87280e2
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/html/_js_base.html.template
Original file line number Diff line number Diff line change
Expand Up @@ -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;
</script>

0 comments on commit 87280e2

Please sign in to comment.