Mobile app version of vmapp.org
Login or Join
Voss4911412

: How can my site detect mobile phones and switch visitors to a mobile Domain? My Question is that when user enter the website: http://www.example.com then they will just go to automatically to

@Voss4911412

Posted in: #301Redirect #Cpanel #Dns #Mobile #Redirects

My Question is that when user enter the website: www.example.com then they will just go to automatically to www.example.mobi how can i do this .. is their any technique behind that.

Can i do this via cPanel etc?. Tutorial links are welcomed.

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Voss4911412

2 Comments

Sorted by latest first Latest Oldest Best

 

@Ravi8258870

The first method (screen.width<=799) is not reliable. On my Android, I get a screen width of 540 when the phone is being held upright (portrait view), but if I turn it on its side (landscape view), I get width=960. Better (maybe still not fully reliable) might be to bounce to mobile if either dimension is small:

if ((screen.width <= 699) || (screen.height <= 699)) {}

10% popularity Vote Up Vote Down


 

@Radia820

To redirect only mobile traffic to a mobile domain there are a few options:-


Simple


Based on screen resolution (my favorite as it's fairly future proof)

<script type="text/javascript">
<!--
if (screen.width <= 699) {
document.location = "www.mobileurl.com";
}
//-->
</script>



More granular control

detectmobilebrowsers.mobi/ offers more complete control with a free script which handles redirection to a single place, or multiple places based on device (don't be fooled by all the buy buttons!)

require_once('[mobile_device_detect.php][4]');
mobile_device_detect(
'http://iphone-url.com',
'http://ipad-url.com',
'http://android-url.com',
'http://opera-mini-url.com',
'http://blackberry-url.com',
'http://palm-os-url.com',
'http://mobile-url.com',
'http://mobile-browsers-url.com',
'http://desktop-url.com');


Allowing traffic from different devices to be sent to different urls.


Extremely granular control


Other than that there are device description databases like WURFL which offer even more in depth control by providing a database that can be queried using device header information and traffic redirected accordingly...

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme