+ 2
How works mobile sites?
How does work that, we go to full (PC version) domain and our smartphones load mobile version. For example, tapping www.youtube.com but the browser load www.m.youtube.com. That happend on the server or client side? It is some special script, file or what?
3 Respuestas
+ 18
As far as i know it can be easily done with Javascript detecting the User Agent, there are plugins like "User Agent Switcher" that allow you to visit the mobile version of websites like youtube, in PC too.
Chris Coyer made an article here:
http://bit.ly/2tRESPu
Another (more extensive) reference: http://bit.ly/2uUHJfo
Just remember that Javascript is a client-side language and can be deactivated by the user. ;)
+ 3
basically the web server detects the user agent u r using and automatically toggles the site
+ 2
There are several ways(code) to detect user browser, using JavaScript, or php..
This an example of using php :
<?php
$browser = get_browser(null, true);
if ($browser['ismobiledevice']) {
header('Location: http://m.web_name.com/');
} else {
header('Location: http://www.web_name.com/');
} ?>