I'm working on a website and want to make it mobile friendly. I thought it would be nice to redirect the mobile devices to an extra subdomain. The concept is following.
How to detect that it is a mobile device?
Checking with Javascript if the device is bigger than 1000px like this:
if (screen.width <= 1000) {
document.location = "mobile.html";}
I'm not so good in Javascript so I dont know if there is an option to redirect to an URL instead of a document.
I have read that it is possible with the .htacces file but I have no clue how this code works which is in this file. Often there is no explanation how it detects mobile devices. I don't want some link with "Go here to mobile version".