I am using a java script to redirect from my website if it detects a mobile site by using less than 600 pixels

Can I add a java script to my mobile site so it will redirect them to my my main desktop site if greater than 600 pixls and what would it be.