With advancement in mobile technology, WAP, EDGE and GPRS technology global number of mobile Internet users is increasing daily. So it’s a good idea to make a mobile version of websites. Usually mobile browsers are different from PC browser so making two different sites, one for PC and one for Mobile is necessary as mobile browser cannot show contents made for PC browsers correctly.
So after you make a mobile version of your site it’s important to redirect your visitors to your mobile site if they open your site from a mobile browser. That’s what we are going to learn here.
So the basic idea is the mobile browsers usually have display of less resolution compared to PC. So if we find out the screen resolution or height or width of display we can redirect the visitors having less screen size to our mobile site.
Below is a JavaScript code to do the job. You need to place the code some where in the head tag of your website or some where between <head> and </head>
It will find out the width of display of the device and redirect visitors to another website if the screen width is less. I have set the width in the code as 600 pixels or the code will redirect visitors having screen width less than 600 pixels to your mobile site. you can increase or decrease the width according to your need. And don’t forget to replace yourmobilesite.com with the URL of your mobile site.
The code::
<script type="text/javascript">
if(screen.width < 600){
window.location = "http://yourmobilesite.com";
}
</script>
Popular Searches:
- redirect mobile visitors
- html code to redirect to mobile site
- redirect to mobile site javascript
- redirect visitors to mobile site
- how to get website to identify mobile
- how website know mobile
- how to detect your web visitors screen size and browser
- javascript mobile redirect
- javascript mobile redirect code
- Pc and mobile page redirect
- mobile redirect javascript code
- how to find mobile websites
- online mobile redirect
- redirect mobile browsers javascript
- javascript redirect mobile
- php redirect code website screen size
- code added to index page that will re direct visitor using a mobile device to mobile web site
- redirect to mobile struts
- device width redirect
- pc to mobile redirect code
- redirect mobile site screen size
- mobile site redirect
- redirect mobile browsers to mobile site
- how to redirect mobile users screen size
- get mobile visitors
- find mobile websites
- redirect for mobile visitors
- if mobile redirect
- how to detect all mobile browsers and redirect your visitors to mobile version Javascript Code
- mobile redirect resolution less then

7 Comments
Good! It work.
hi will this code interfere with any SEO or google bots… please comment asap
@stan
No it will not interfere with SEO or Google. As this is simply a javascript code and Google can still read contents in your site even if this code is used.
Thank you!!!!!!
Okay – this seems clean and simple. But what happens if the mobile site visitor decides to click “full site”?!?!? Do they get stuck in an endless loop? How do we avoid that? thx
@dena
The solution can be:
You can build a index.html page and use the above code there to redirect your mobile visitors to your mobile site , and all normal visitors can be redirected to index.php or other files.
And from your mobile site you can place a link to index.php page.
That was a informative material. I enjoyed it very much. Let me know about new posts, sakmann bert