I'm using the following to use WebP images with a JPG fallback:
<img 
    src="{{ $img_webp_desktop.RelPermalink }}" 
    onerror="this.onerror=null;this.src='{{ $img_jpg_desktop.RelPermalink }}';" 
    loading="lazy"
    height="{{ $img_jpg_desktop.Height }}" 
    width="{{ $img_jpg_desktop.Width }}">
However, with my CSP set to script-src 'self', the onerror inline script doesn't get executed and the fallback doesn't work.
Is there any way to make this work with the CSP? Worst case scenario, I can enable unsafe-hashes.
Thanks in advance :)
 
    