Skip to content

Directive: img src

Ryan Parman edited this page Jun 14, 2024 · 8 revisions

Overview

The img-src directive specifies valid sources of images and favicons.

Affects: <img>; <link rel=icon>; <picture> → <source>

Required reading:

Usage examples

Accepts one or more schemes or hosts, the 'self' keyword, or the 'none' keyword.

img-src 'none'
img-src 'self'
img-src example.com
img-src example.com example.org
img-src https://*.example.com
img-src https:

Fallbacks

img-src will fallback to default-src if it is undefined.

Possible errors

  • CSP-0100 — [ERROR] directive %s has an invalid value %s

For developers

ABNF (CSP3)

directive-name  = "img-src"
directive-value = serialized-source-list

See ABNF: serialized-source-list

Type

References

Clone this wiki locally