Responsive sites – can we put a link to ‘see full version’ on the mobile site
Hi smart developers
if a site is responsive – on the mobile device is there a way we can place an option on the mobile site to say ‘view full version of site’ to link to the desktop version??
thanks.
Juan Villegas 8:35 pm on February 4, 2014 Permalink | Log in to Reply
Yes, if the css is properly designed you should have (at least):
-css file with main styles
-css file with media queries and device specific rules
In a traditional request you would load all the css files, and let the browser apply them. If the user requests the desktop version, you should only load the css files that apply desktop rules (usually, main file and the device-specific file that correspons to desktop.. 968-1200px wide)..
To decide wether to force desktop or not, id create a link as follows:
–“>Go to Desktop version of this site
In the php code:
if( isset( $_GET[‘force’]) OR IF THERE IS A COOKIE ALREADY SET){
// here we should set a cookie set_cookie(‘force’, …. ), otherwise the user will see original site in subsequent requests
// get desired version
$version = $_GET[‘force’];
}else{
$version = ‘all’;
}
in header.php or wherever you are loading css:
//load main css
…
//decide wehter to load device-specific css
if( $version == ‘all’ || $version ==’desktop’){
//load desktop
}
if( $version == ‘all’ || $version ==’mobile’){
//load mobile
}
Thats a quick draft but it could be shorter if we think a little about it hehe
Juan Villegas 8:36 pm on February 4, 2014 Permalink | Log in to Reply
WordPress removed my php code.. to create the link use:
href=” CODE HERE”
CODE HERE = PHP>> echo add_query_arg(‘force’,’desktop’) <
Juliette Cook 10:08 pm on February 4, 2014 Permalink | Log in to Reply
thanks – a lot of that makes no sense to me but the developers will get it 😉 . So here is another question – a client wants his site ‘responsive’ but wants the top navigation items visible as opposed to a responsive site saying ‘Navigation Menu” so that a user can see his specialties right away. Can we do this – alter what is responsive and what is not>????? how long would this take and what would it entail?