Zen Cart Logo
Forums / Addon Templates / trouble getting mobile redirection to go back to the full site

trouble getting mobile redirection to go back to the full site

Views: 1,821

Results 1 to 3 of 3
7 Nov 2011, 1:15 AM
#1
amanda61 avatar

amanda61

New Zenner

Join Date:
Jun 2008
Posts:
4
Plugin Contributions:
0

trouble getting mobile redirection to go back to the full site

Hi

FYI I have a mobile version of my zen cart site, it's done in wordpress. I have no problem with redirection to the zen cart 'full site' as I have been given a script for this, but trying to get the 'mobi' wordpress site to override the redirection to go back to the full site is an issue at present. As my customers are searching for specified products I need them to go to the full site for the cart & product info. The mobi site is really only what we are about, location etc as the site has to be small to be efficient in terms of upload time etc... I'm a newbee at this & have no techincal knowledge, so please bear with me on the terminology... also I have turned off the redirection in the short term till I get it right.... so if you have any answers let me know :)
full site https://www.footforward.co.nz
mobi site https://www.footforward.mobi

10 Nov 2011, 5:42 PM
#2
lackew avatar

lackew

Zen Follower

Join Date:
Aug 2009
Location:
Tampa Bay
Posts:
223
Plugin Contributions:
1

Re: trouble getting mobile redirection to go back to the full site

I just created a mobile site also
can you share how to get the full website to recognize mobile devices so it will auto load or transfer to the condensed site???????????

11 Nov 2011, 5:07 PM
#3
lackew avatar

lackew

Zen Follower

Join Date:
Aug 2009
Location:
Tampa Bay
Posts:
223
Plugin Contributions:
1

Re: trouble getting mobile redirection to go back to the full site

I found a couple of scripts but dont have an idea how to implement them

==========================================

  1. Place the following code ABOVE the </head> tag
    Remember to change http://m.google.com to your mobile url
    ==========================================
<!--Simple Mobile Redirect--> <script type="text/javascript"> if(window.location.hash != '#r=off') { if (screen.width <= 1023) { document.location = "http://m.google.com"; } } </script>

==========================================
2. Place the following code ABOVE the </body> tag

<script type="text/javascript"> if(window.location.hash == '#r=off') { var a = document.getElementsByTagName('a'), href; for(var i = 0; i < a.length; i++) { href = a\[i].href.toLowerCase(); if((href.indexOf("http://") == -1 && href.indexOf("https://") == -1) || (window.location.hostname && href.indexOf(window.location.hostname) != -1)) { a\[i].href = href + '#r=off' } } } </script>
<?php $mobile_browser = '0'; if(preg_match('/(up.browser|up.link|mmp|symbian|smartphone|midp|wap|phone)/i', strtolower($_SERVER['HTTP_USER_AGENT']))){ $mobile_browser++; } if((strpos(strtolower($_SERVER['HTTP_ACCEPT']),'application/vnd.wap.xhtml+xml')>0) or ((isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE'])))){ $mobile_browser++; } $mobile_ua = strtolower(substr($_SERVER['HTTP_USER_AGENT'],0,4)); $mobile_agents = array( 'w3c ','acs-','alav','alca','amoi','audi','avan','benq','bird','blac', 'blaz','brew','cell','cldc','cmd-','dang','doco','eric','hipt','inno', 'ipaq','java','jigs','kddi','keji','leno','lg-c','lg-d','lg-g','lge-', 'maui','maxo','midp','mits','mmef','mobi','mot-','moto','mwbp','nec-', 'newt','noki','oper','palm','pana','pant','phil','play','port','prox', 'qwap','sage','sams','sany','sch-','sec-','send','seri','sgh-','shar', 'sie-','siem','smal','smar','sony','sph-','symb','t-mo','teli','tim-', 'tosh','tsm-','upg1','upsi','vk-v','voda','wap-','wapa','wapi','wapp', 'wapr','webc','winw','winw','xda','xda-'); if(in_array($mobile_ua,$mobile_agents)){ $mobile_browser++; } if (strpos(strtolower($_SERVER['ALL_HTTP']),'OperaMini')>0) { $mobile_browser++; } if (strpos(strtolower($_SERVER['HTTP_USER_AGENT']),'windows')>0) { $mobile_browser=0; } if($mobile_browser>0){ header('Location: <http://YourSite.mobi/mobile'%29;> } else { header('Location: <http://YourSite.mobi/pc'%29;> } ?>

the only thing I can think of is have a landing page (intro)