How to redirect to mobile site
Redirect to mobile site because its easy! So you have your website set up and a mobile friendly site but you still need to redirect to mobile site. What we can do is use #javascript to figure out what size screen the user is using. If they surfer is using a smaller browser like that on a tablet or a cell phone we may want to redirect that person to out mobile site. I have included a script here that you should put in your head tags on your website. Now you can use this script to also point anyone with a smaller browser to any site that you wish but we will assume that you just want to direct them to another part of your website. Here is what the script looks like. In this script we are redirecting everyone that has a screen size 699 pixels or smaller to another part of our website. I also included an iPhone redirect script to tell iPhones where to go and it does not matter what their screen size is, lol.
<script type="text/javascript"> <!-- if (screen.width <= 699) { document.location = "folder/index.php"; } //--> </script> <script language=javascript> <!-- if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) { location.replace("https://www.a1websitepro.com/index.php"); } --> </script>Redirect to mobile site is easy using this code all you have to do is replace the destinations. If you need lessons on how to edit php please visit our lessons page.