Rate This Post

Javascript Mobile Device Detection

Javascript Mobile Redirect CodeHere 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.

Javascript Mobile Redirect Code:

<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

  • AT&T
  • Acer
  • Alltel
  • AnexTEK
  • Apple
  • Archos
  • Asus
  • Audiovox
  • BenQ
  • BlackBerry (RIM)
  • Bluebird
  • Casio
  • Cellcom
  • Commtiva
  • Daxian Telecom
  • Dell
  • Dopod
  • E-TEN
  • Emobile
  • Fujitsu Siemens
  • GSL
  • Garmin
  • General Mobile
  • Getac
  • Gigabyte Communications
  • Google
  • HP
  • HTC
  • HandEra
  • Handspring
  • Hitachi
  • IBM
  • Kyocera
  • LG
  • Lenovo
  • MWg
  • Mexmal
  • MiTAC
  • Mobinnova
  • Motorola
  • Movistar
  • NEC
  • Nautiz
  • Nokia
  • O2
  • Orange
  • Packard Bell
  • Palm
  • Palmax
  • Panasonic
  • Pantech
  • Pharos
  • Qool Labs
  • Qtek
  • Razor
  • RoverPC
  • Sagem
  • Samsung
  • Sendo
  • Sharp
  • Siemens
  • Sierra Wireless
  • Smart
  • Socket Communications
  • Softbank
  • Sony
  • Sony Ericsson
  • Sprint
  • Symbol
  • T-Mobile
  • TMN
  • Tapwave
  • Telefonica
  • Toshiba
  • Tripod Data Systems
  • UBiQUiO
  • Velocity Mobile
  • Verizon
  • ViewSonic
  • Vodafone
  • i-mate

Platform

  • Palm
  • Pocket PC
  • Symbian
  • BlackBerry
  • Android
  • Smartphone
  • IPhone OS
Share This
HostUtopia Web Hosting