How to Redirect Website to a Mobile Version when Accessed on a Mobile Device

119

if (screen.width <= 800) {  window.location = "http://m.domain.com";}
 <?php
 $iphone = strpos($_SERVER[‘HTTP_USER_AGENT’],”iPhone”);
 $android = strpos($_SERVER[‘HTTP_USER_AGENT’],”Android”);
 $palmpre = strpos($_SERVER[‘HTTP_USER_AGENT’],”webOS”);
 $berry = strpos($_SERVER[‘HTTP_USER_AGENT’],”BlackBerry”);
 $ipod = strpos($_SERVER[‘HTTP_USER_AGENT’],”iPod”);

 if ($iphone || $android || $palmpre || $ipod || $berry == true) 
 {
     echo “](https://s3.amazonaws.com/woocms.woorank.com/2020/05/poor-mobile-optimization.png”;
  }
 ?>

Comments

Submit
0 Comments