I am using the following script to redirect a mobile user to my mobile site.
I have my code in header.php which i then include via my index.php file.
header.php:
<script>
function urlParam(name){
var results = new RegExp('[\\?&]' + name + '=([^&#]*)').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://m.hewdenportal.co.uk";
}
// ]]>
}
</script>
index.php:
include 'header.php';
on my mobile site i have the following link which should take the user to my full site:
<a href="http://www.hewdenportal.co.uk?view=full" data-ajax="false">Full Site</a>
for some reason this doesn't seem to keep the user on the full site and keeps redirecting them to the mobile site. please can someone show me where i am going wrong?
Thanks