In order to retirect users of my website to a mobile version of the site, I was thinking of using the following script (which would run onload of the website):
function devdetect() {
var x = screen.width;
if (x < 500) {
window.location = "http://m.1encrypt.com"
}
}
Is this an effective way of performing this task, or would it fail to work properly for some devices? I know that there are numerous threads on here relating to detecting mobile devices. My question is, what's wrong with this method?