Maine Hosting Solutions - Web Hosting Made Easy Since 1996  WordPress Web Hosting  View Cart  Maine Web Design  Order  eCommerce Web Hosting  Login  divider Social Media
WordPress Web Design

Javascript Mobile Redirect Code For ANY Mobile Device

Posted on: Wednesday, August 22nd, 2012 at 4:29 pm

Javascript Mobile Device Detection

Here is the simplest Javascript Mobile Redirect Code we’ve found. It work regardless of the device, as long as it’s screen size is less that what you specify in the script. In this example and device that has a screen smaller than 700 pixels will get your mobile website redirect. The idea is that mobile devices will not have a screen width wider than a certain pixel size (e.g. 700 or 800). Users with a screen width less than what you specify will be redirected to the mobile site. Here’s an example of the Javascript you would want to insert into each of your pages:

<script type=”text/javascript”>
if (screen.width <= 700) {
window.location = “”;

Having a mobile version of your website is a great way to make sure that visitors using a mobile device are able to properly view your site on their device. Some tools for creating mobile versions of websites have built-in options for redirecting visitors to the mobile versions. If not, you will want to redirect mobile visitors to the right version.

This Javascript Redirect Code works for all of the following mobile device manufacturers and platforms, and more:


Maine Hosting Solutions  •  122 Front St., Bath, Maine 04530  •  1-888-200-8008 or 207-442-9006  •  ContactSecure Order Button
 Web Hosting | Dedicated Servers | Web Design | Promotion | Privacy Policy | Support | Blog | SiteMap | LOGIN 
© 2014 Maine Hosting Solutions, All Rights Reserved
LinkedInSocial Media LinksTwitterLinkedInRSS