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 = “https://yourweburl.com/mobile/”;
}
//–>
</script>

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:

Manufacturer


Analyze My Website

Register a Domain Name

Maine Hosting Solutions  •  122 Front St., Bath, Maine 04530  •  1-888-200-8008 or 207-442-9006  •  ContactSecure Order ButtonWe Accept PayPal, Visa, American Express and MasterCard
 

HOSTING

SOLUTIONS

WEB DESIGN

PROMOTION

ABOUT

 Web Hosting Plans
WordPress Hosting
Spam Protection
SSL Security
Transfer My Website
Reseller Hosting
Affiliate Plan
[Product List]
Domains
Content Management
WebMail Services
PCI Compliance
App ToolBox
Backups
Website Builder
Builder Comparison
WordPress
eCommerce
Responsive Design
Mobile Design
Website Walkons
Video Production
WordPress Plugins
Design Portfolio
Search Engine Optimization
Local Listings Service
GPS Map Registration
FREE Website Analysis
Website Speed Test
Broken Link Checker
SEO Client Login
SEO Blog
About MHS
Meet The Crew
Our Technology
How We Give Back
Reviews
Privacy Policy
© 2014 Maine Hosting Solutions, All Rights Reserved
GoogleFacebookTwitterLinkedInRSS