I'm interested in using a php if statement to include or exclude code based on the user's browser size. For example, a slider will only load if the user's browser size is greater than 768 x 900px.
I know how to hide an object using the css viewport, but I imagine the page speed would increase if I could simply not load the code at all, rather than hiding it.
A few questions so I can better understand
1) Is PHP capable of detecting a user's browser size?
2) Is an if statement a feasible way of achieving this?
3) Am I correct in assuming that not loading the code altogether is more efficient than just hiding the output via css?
4) I haven't started learning javascript yet, would you recommend that as the best way to achieve this?
Any help is really appreciated!