Looking to Build/Redesign a Website or Blog ?

To speak to Rakshit, call +91 968 704 2303

Redirect your website to Mobile Version using Javascript

Hello Friends,

I am working on project where I need to Redirect website to mobile version of website using javascript. For this, I need to create a javascript code which tracks mobile device and if it found mobile device than I can just use location.href to redirect user to mobile version of website.

Here is the code to track mobile devices like, iPhone, iPad, Android and Blackberry. You just need to copy below code and put it in your main website. So whenever user open your website in mobile device, this code will track it and execute redirect code and user will be taken to mobile version of website.

<script type="text/javascript" language="javascript">// <![CDATA[
if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPad/i)) || (navigator.userAgent.match(/blackberry/gi)) || (navigator.userAgent.match(/android/gi)))
{
   location.replace("http://mobile.programmingfacts.com");
}
// ]]></script>

Redirect your website to mobile version using javascript, Redirect to Mobile version using javascript, Mobile Redirects using javascript, Redirection Code for Mobile, Mobile Redirect jQuery, Javascript Mobile Redirection code, Generate Javascript code for Mobile Redirect

Share:

No Comments Yet.

Leave a Reply

Your email address will not be published.