Is it possible to have a pathname in a srcset with an embedded blank?

1.1k Views Asked by At

I have searched the web and have only come up with this: https://bugs.chromium.org/p/chromium/issues/detail?id=422914

I'd like to have an html source statement that looks like:

<source srcset="/assets/root/some picture.png"   media="(orientation:portrait) and (max-height:760)">

but I fear the browser's parser looks for a blank/space as a delimiter for a width delimiter. See, for instance, https://cloudfour.com/thinks/responsive-images-101-part-4-srcset-width-descriptors/

So, to reiterate the title of this question: Is it possible to have a pathname in a srcset with an embedded blank?

1

There are 1 best solutions below

1
On

You can URL-encode the space so it will not be mistaken for a delimiter:

<source srcset="/assets/root/some%20picture.png"
        media="(orientation: portrait) and (max-height: 760px)">