redirect - Jquery mobile full site link loads full site, but links there go to mobile site -


i think i've looked on 50 different examples online, can't find same problem.

i've got jquery mobile site , full site (it's wordpress site). i've put following code in header.php file of full site:

    <script type="text/javascript">     function urlparam(name){                 var results = new regexp('[\\?&amp;]' + name + '=([^amp;#]*)').exec(window.location.href);                 if(results)                     return results[1] || 0;                 else                     return '';             }              if(urlparam('view') == 'full'){              }             if(urlparam('view') == ''){                 // <![cdata[                 var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.useragent.tolowercase()));                   if (mobile) {                          document.location = "http://mysite.com/mobile/index.html";                   }                   // ]]>             }     </script> 

this works fine , when load full site on iphone redirects mobile version.

however, have link full site on mobile site so:

    <li><a href="http://albariancoins.com/?view=full" rel="external" data-ajax="false">full site</a></li> 

when click link take me full site, if click on links on full site, redirected mobile site.

fyi, i've tried (and failed) setting cookies. scripts i've used haven't worked (i'm sure it's fault) , end stuck in continuous redirect.

first off, need statement: if(urlparam('view') != 'full'){ check if mobile , redirect.. }

i suggest use document.write(urlparam('view')); check urlparam('view') returns. should make easier debug. though best way debug use chrome or firefox tools.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -