Divya, I’m sorry to hear that you think this technique is antiquated but I think you may be focusing on the specifics of the width detection rather than the idea.
As I said, I’ve posted some follow-on ideas on my blog about detecting CSS changes rather than directly measuring viewport width with clientWidth.
But in any case, I hope you can see beyond the specifics of my unworthy antiquated if statement and recognise that it is the thinking behind conditional loading that is important rather than the code itself.
Divya, I’m sorry to hear that you think this technique is antiquated but I think you may be focusing on the specifics of the width detection rather than the idea.
As I said, I’ve posted some follow-on ideas on my blog about detecting CSS changes rather than directly measuring viewport width with clientWidth.
But in any case, I hope you can see beyond the specifics of my unworthy antiquated if statement and recognise that it is the thinking behind conditional loading that is important rather than the code itself.