There’s a lot of talk about loading web assets based on device width or screen size. That is, load full content for desktop browsers over 640px, but alternate content for devices with screens of 640px or smaller.
Right now in HTML, if a person visits a web site designed for large and small screens, the smaller device will still download the larger site’s version (larger imgs and Javascripts for large screens), then the smaller images (and leaving out the large JS code) for the smaller device.
Is is possible to programmatically load certain includes in PHP, perhaps based on device-width media queries? That way, small devices would never load the full-size content in the first place, resulting in a faster download. If so, can someone give an example of PHP code executing depending on device width?
Thanks!