How to add mobile redirect code

  • Author
    Posts
  • #1146531

    I want to add redirect code for my existing mobile website into the ehader

    The blog I need help with is thenewplumbingguide.wordpress.com.

    #1146615

    <script type="text/javascript">
    var url='http://books.indygetmobile.com/';var host_name=document.location.hostname;var request_uri=document.location.pathname;var no_mobile=location.search;var cookie=document.cookie;
    function detect(){var ua=navigator.userAgent.toLowerCase();var devices=['vnd.wap.xhtml+xml','sony','symbian','nokia','samsung','mobile','windows ce','epoc','opera mini','nitro','j2me','midp-','cldc-','netfront','mot','up.browser','up.link','audiovox','blackberry','ericsson','panasonic','philips','sanyo','sharp','sie-','portalmmm','blazer','avantgo','danger','palm','series60','palmsource','pocketpc','smartphone','rover','ipaq','au-mic','alcatel','ericy','vodafone','wap1','wap2','teleca','playstation','lge','lg-','iphone','android','htc','dream','webos','bolt','nintendo'];for(var i in devices){if(ua.indexOf(devices[i])!=-1){return true}}}
    if(no_mobile!='?nomobile=1'&&cookie.indexOf('no_mobile')==-1){is_mobile=detect();if(is_mobile){window.location=url}}else{if(cookie.indexOf('no_mobile')!=-1){}else{cookie_expires=new Date();cookie_expires.setTime(cookie_expires.getTime()+60*60*24);document.cookie="no_mobile=1; expires="+cookie_expires.toGMTString()+"; path=/;"}}
    </script>

The topic ‘How to add mobile redirect code’ is closed to new replies.