Redirect Mobile devices to a mobile site

Place any one of these three codes in the head section of the main page of your site.
 

<script type="text/javascript">
  <!--
  if (screen.width <= 800) {
    window.location = "http://m.domain.com";
  }
  //-->
</script>


OR

<script type="text/javascript”> 

<!-- if (screen.width <= 699) { document.location = "mobile.html"; } //--> </script>

OR

<script language=javascript> 
<!-- if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { location.replace("http://url-to-send-them/iphone.html"); } --> </script>

You may edit and add iPad instead of those above or add the line again
  • 1 Users Found This Useful
Was this answer helpful?

Related Articles

HASH & PASSWORD CONVERTORS

Generates passwords and hasheshttp://hash.online-convert.com/sha1-generatorCracks Password...

iPad redirect using .htaccess

RewriteCond %{HTTP_USER_AGENT} ^.*iPad.*$ RewriteRule ^(.*)$...

.htaccess information

A good source of tools and info. http://www.htaccesstools.com

.htaccess REDIRECTION RULES

REDIRECTION Learn how to perform temporary redirection and permanent redirection using PHP,...

REDIRECT A WEBPAGE WITH HTML CODE

Place this code in between the section of your webpage. The content number is the number of...