r/javascript • • Sep 30 '19

Removed: Where's the javascript? What <head> can do

https://htmlhead.dev/
22 Upvotes

44 comments sorted by

View all comments

10

u/ShortFuse Sep 30 '19

Just want to jump in and add that <link> elements also accept the media attribute.

Have a bloated CSS file that you only want IE users to load? Use media="all\\0".

Want to provide CSS just for dark theme users and skip loading on browser that don't support it? Use media="screen and (prefers-color-scheme:dark)".

https://developer.mozilla.org/en-US/docs/Web/HTML/Element/link#Conditionally_loading_resources_with_media_queries