New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Policy: lazyload #193

Open
ehsan-karamad opened this Issue Jul 30, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@ehsan-karamad
Contributor

ehsan-karamad commented Jul 30, 2018

Proposing a new feature policy for lazy-loading which will overwrite the default or specified behavior of lazyload attribute for <iframe> and <img>. The proposed name for the feature is lazyload.

The lazyload attribute (for an <iframe> or <img>) takes on three values of auto (decision of lazy-loading is deferred to the user agent), on (the contents will be loaded lazily), off (the contents will not be loaded lazily).

The proposed lazyload feature is a parameterized feature which takes one of the three values of:

  • auto: the default behavior of lazyload attribute is not altered (user agent decides) .
  • off: the default behavior of lazyload is set to off.
    For example, if the site www.example.com sets its header policy to Feature Policy: lazyload 'self'(off), then
 <iframe src="https://www.example.com/a" lazyload="on"></iframe>

will still load the contents lazily due to the defined attributes, but

<iframe src="https://www.example.com/b"></iframe>

will not load the contents lazily since the feature is set to off by default.

  • force: ignores the value of lazyload attribute and enforces it to on for all <iframe> and <img> .
    For example, if a site sets its header policy to Feature Policy: lazyload *(force) then all <iframe>'s and <img>'s from all domains will be loaded lazily. For example in
<iframe src="http://www.example.com/" lazyload="off"></iframe>

the provided attributed is ignored and the contents will be loaded lazily due to policy enforcement. Also, since the lazyload attribute setting is in violation of the lazyload feature, such a usage may trigger a violation error.

The feature can also be set through container policies, for instance:

<iframe allow="lazyload *(force)" src="https://www.example.com" lazyload="off"></iframe>

which will enforce lazy loading for all domains. This would include https://www.example.com.

@Malvoz

This comment has been minimized.

Show comment
Hide comment
@Malvoz

Malvoz Jul 31, 2018

Contributor

Just to clarify, I believe you missed the single quotes for the self and none values. And I would assume we set (auto|off|force) flags outside the single quotes? e.g. Feature Policy: lazyload 'self'(force) and the all (*) directive like so: Feature Policy: lazyload *(force).

Contributor

Malvoz commented Jul 31, 2018

Just to clarify, I believe you missed the single quotes for the self and none values. And I would assume we set (auto|off|force) flags outside the single quotes? e.g. Feature Policy: lazyload 'self'(force) and the all (*) directive like so: Feature Policy: lazyload *(force).

@ehsan-karamad

This comment has been minimized.

Show comment
Hide comment
@ehsan-karamad

ehsan-karamad Jul 31, 2018

Contributor

Thanks you are right. I fixed the missing single quotes for self.

Contributor

ehsan-karamad commented Jul 31, 2018

Thanks you are right. I fixed the missing single quotes for self.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment