I’m experienced in using media queries to target CSS to specific browser sizes/or contexts, but now I’m interested in doing this with JS, essentially having more control over how my scripts run on browsers of different abilities.
I’m not asking for how to duplicate the functionality of media queries in JS, but more what are the methods for controlling which code gets run on which browsers?
Is there a method or system that would give me this control without resorting to detecting browsers?
There really isn’t anything to control how where your code is run unless you do some ground work in detecting the situations you want the code to run in and wrapping things in if blocks. You can use conditional statements in HTML, if blocks in your generating server code, or in the js itself.