There is a html page that I have no control over, ditto goes for any javascript.
I can however style it, and one of the thing's I've done is injected a slab of text via content
in a CSS pseudo-element.
However this slab is multiple lines and with CSS strings being only one line leads to a cumbersome property full of \0a
s.
I was wondering whether I could use the url(blah/blah)
syntax with content
in place of a string; and the docs say yes!
However, when I try it (the slab now unencoded and hosted in it's own file), the content doesn't show.
Looking in the networking tab of the devtools shows it is requested, but it looks like the browser is ignoring it.
At first I thought it was a headers issue (I was working just out of the filesystem), so I built a tiny server to apply text/plain
(I also tried text/html
) on localhost.
It appears the browsers are only accepting images for content
, with the following header seen to be sent with the request in chrome's devtools; Accept:image/webp,image/*,*/*;q=0.8
.
This issue occurs in firefox too, so why does the mdn specifically use a .html
example in the syntax?
Is there any way to get something like what I'm attempting up and running, or am I left to deal with the long CSS statement?