It is best if this code is placed between and so it can be recognized first and redirect any mobile users quickly:
What this code does is it says, "If the screen size of the device viewing this website is less than 800 pixels wide, then redirect them to http://yourdomain.com/mobile/" (replace this with anything).
This can also be used to redirect mobile visitors to a YouTube video, a specific page on your website, or something else. A specific page on your website may be best (so they can still click around and access other parts of your website).
Update:
Since the sizes of mobile screens vary so much, it is best to detect by user agent. We suggest following these steps to set up more accurate mobile redirection:
1. Download the Javascript version from http://detectmobilebrowsers.com and save to desired folder (eg. /javascript). Let's name it redirect.js.
2. Edit redirect.js, find and change http://detectmobilebrowser.com/mobile to you mobile URL.
3. In your website header between and , add within head tags.
Source: http://notixtech.com/blog/how-redirect-mobile-users-your-website
No comments:
Post a Comment