Redirect To Mobile Website

Life is 10% what happens to us and 90% how we react to it. If you don't build your dream, someone else will hire you to help them build theirs.

Redirect To Mobile Website

Copy and paste the below code into your main web site head section.

<script type=”text/javascript”>
if (document.location.search.indexOf("skipmobile") >= 0) {
document.cookie = "skipmobile=1";
}
else if ((document.location.hostname.match(/\.mobi$/) ||  screen.width < 699)
&& document.cookie.indexOf("skipmobile") == -1)
{
document.location = "mobiledomain";
}
</script>

This code does 3 things:
1. Redirects mobile users to your mobile site.
2. Allows mobile users to go back to the full site if desired.
3.Redirects domain names ending in .mobi to the mobile version of your site.

On the Mobile Site:

Add a link to redirect to “View Full Site”. Then in the url area, type your website address (ie. http://www.MyWebsite.com) and then put ?skipmobile=1 at the end ( ie. http://www.MyWebsite.com/?skipmobile=1 ).

Above code will create a cookie “skipmobile” in the main site and check the cookie value each time, when page load at main site. If it is not set then page redirected to the mobile site.