top | item 45107213

(no title)

yuchi | 6 months ago

As good as a script element with type application/json.

discuss

order

joeframbach|6 months ago

I wonder if the browser would attempt to validate the contents of a script tag with type json, versus treating it as a blob that would only be validated when parsed/used. And any performance overhead at load time for doing so. Not at a machine at the moment so I can't verify.

alserio|6 months ago

well one difference is that application/json scripts are still subject to CSP policies

unilynx|6 months ago

How so? I don't remember ever having seen issues with this. If anything CSP steers you towards this (instead of inline scripts directly assigning to JS variables)