Skip to content

Commit 0556932

Browse files
committed
docs(readme): provide further information
especially on the other polyfill
1 parent f2fe8d3 commit 0556932

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Fast and lightweight vanilla JavaScript polyfill for native lazy loading, meanin
3030
- Web standards: supports the standard `loading="lazy"` attribute on `img` and `iframe` elements
3131
- Performance: it's based on highly efficient, best practice code.
3232
- SEO & crawlers: the image and iframe contents aren't being hidden from crawlers that aren't capable of scrolling.
33-
- Supporting HTML generating JavaScript frameworks through a method provided to reinit its functionality
33+
- Supporting HTML generating JavaScript frameworks through a method provided to reinit its functionality (see "Another solution, especially in combination with JavaScript framework usage" as well)
3434

3535
## Core concepts
3636

@@ -39,6 +39,16 @@ The polyfill was designed with the following concepts kept in mind:
3939
- dependency-free
4040
- using JavaScript with graceful degradation
4141

42+
## Another solution, especially in combination with JavaScript framework usage
43+
44+
We're even also providing [another solution](https://github.com/mfranzke/loading-attribute-polyfill-with-serviceworker), which main architectural decision is that we're using Service Worker to intercept the image and iframe contents network requests there. This comes with some aspects that are important to mention, that might be either acceptable (have a look at the [other solution](https://github.com/mfranzke/loading-attribute-polyfill-with-serviceworker)) or not (stay with this one) on your requirements and technical context.
45+
46+
- Service Workers only run over **HTTPS**, for security reasons
47+
- Service Worker need to get **registered on first page visit**
48+
- Only works on **same domain** network requests
49+
50+
Whereas the first topic might not be a problem (anymore) on most websites – as this should be the de-facto standard nowadays – the second and third might be acceptable in your context, as this polyfill behaves as a progressive enhancement to provide the expected functionality even for non-supporting browsers both only on seconds pages request and any revisits and for same origin image and contents (iframe) requests even only.
51+
4252
## Installation
4353

4454
First you'll need to integrate the JavaScript file into your code.

0 commit comments

Comments
 (0)