diff options
author | 2019-09-10 21:12:38 -0700 | |
---|---|---|
committer | 2019-09-10 21:22:19 -0700 | |
commit | 8d8f78241d303381abf6879cc007ca9cbc2a12e2 (patch) | |
tree | 9c6b8028bd0ff04e2fc6b26992c6de61336b10be /reader/sanitizer/sanitizer.go | |
parent | 937492f6f554d51d8cae62829b6229071cac994e (diff) |
Add native lazy loading for images and iframes
This feature is available only in Chrome >= 76 for now.
See https://web.dev/native-lazy-loading
Diffstat (limited to 'reader/sanitizer/sanitizer.go')
-rw-r--r-- | reader/sanitizer/sanitizer.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/reader/sanitizer/sanitizer.go b/reader/sanitizer/sanitizer.go index 1065e5b..642fedf 100644 --- a/reader/sanitizer/sanitizer.go +++ b/reader/sanitizer/sanitizer.go @@ -137,7 +137,9 @@ func getExtraAttributes(tagName string) ([]string, []string) { case "video", "audio": return []string{"controls"}, []string{"controls"} case "iframe": - return []string{"sandbox"}, []string{`sandbox="allow-scripts allow-same-origin allow-popups"`} + return []string{"sandbox", "loading"}, []string{`sandbox="allow-scripts allow-same-origin allow-popups"`, `loading="lazy"`} + case "img": + return []string{"loading"}, []string{`loading="lazy"`} default: return nil, nil } |