Skip to content

Commit aca7b16

Browse files
committed
docs(readme): provide further information
especially on the other polyfill
1 parent 3c85ee0 commit aca7b16

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 dependency-free vanilla JavaScript polyfill for native lazy
3030
- SEO & crawlers: the image and iframe contents aren't being hidden from crawlers that aren't capable of scrolling.
3131
- JavaScript framework friendly\*
3232

33-
\*As some JavaScript frameworks would like to "own the DOM", it's not a good practice to try to manipulate the HTML content by our polyfill. That for this solution hooks into the network connection (by a Service Worker that you would need to register) to intercept the image and iframe contents requests.
33+
\*As some JavaScript frameworks would like to "own the DOM", it's not a good practice to try to manipulate the HTML content by our polyfill. That for this solution hooks into the network connection (by a Service Worker that you would need to register) to intercept the image and iframe contents network requests. This gives us much more flexibility on the usage contexts, but has some drawbacks, see section ["Prerequisites"](#prerequisites).
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+
## Prerequisites
43+
44+
The main architectural decision to differentiate from other solutions like <https://github.com/mfranzke/loading-attribute-polyfill> is that we're using Service Worker to intercept the image and iframe contents network requests. This comes with some aspects that are important to mention, that you might want to evaluate 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)