Redirect Mobile Users To Mobile Website
If you have a separate mobile website for your mobile/handheld users you can use this simple JavaScript or .htaccess method to redirect users based on their screen width to your mobile website. However it is recommended to use Responsive design instead of a separate mobile URL like m.example.com. But, if you still prefer a separate mobile website and have enough reasons for it lets redirect mobile users to mobile website. Redirect users: The Java Script You can use the code above which detects if the users screen is less then 900px he/she will be redirected to the mobile website. Include the snippet above in your head tag. on some smart phone or tablets width may depend on how the user is holding a phone(portrait or landscape), so it will be better to check some major smart phones width. <script>// <![CDATA[ if (screen.width <= 900) { document.location = "http://m.example.com"; } // ]]></script> You can change m.example.com to yo...