I am using the following script to fire a function depending on whether youre on desktop or mobile. The problem is with retina devices the desktop function is being fired as i guess its pixel ratio is a lot higher. Is there a bullet proof way to get the screens actual pixel size?
var checkWidth = function() {
if (screen.width >= 1240){
desktop();
} else {
mobile();
}
};