Register Advertise with usHelp Desk Today's Posts Search

Closed Thread
Thread Tools Search this Thread
Unread 26th Nov 2012, 03:18 AM   #1
Active Warrior
 
garfield29's Avatar
 
Join Date: 2012
Posts: 71
Thanks: 42
Thanked 7 Times in 6 Posts
Default
Return to Desktop code
Share on: 
fb share twitter share gplus share more share

Anybody knows a code for returning to the desktop from a mobile site?

I'm using a plugin to redirect my site to it's mobile version when visited through mobile devices. But I also need to get it to return to it's desktop version.

I think there's a code for it. The problem is I don't know.

Anybody can help me, please?

-Mau
garfield29 is offline  
Unread 26th Nov 2012, 08:57 AM   #2
Advanced Warrior
War Room Member
 
Brandon Tanner's Avatar
 
Join Date: 2006
Location: USA
Posts: 1,907
Thanks: 237
Thanked 1,377 Times in 676 Posts
Default
Re: Return to Desktop code
Share on: 
fb share twitter share gplus share more share

Any decent redirect script should allow you to do this without triggering an "endless loop". If not, then you'll have to add a few extra lines of code...

1) Set a flag in the "return to full site" hyperlink on the mobile site, like this...

<a href="path/to/full/site/index.php?pref=full">Click Here To View Full Site</a>

2) Wrap a conditional statement around the redirect code on the "full" site, which checks whether or not the flag is set. If NOT, then it allows your redirect code to run.

<?php
if (!isset($_GET['pref'])) {
// Your redirect code goes here
} ?>


The above example uses PHP, obviously, so that page would need to have a PHP extension for it to work. You could do something similar in Javascript or any other scripting language, if you prefer. But I like to use PHP whenever possible, as it's more reliable (a tiny percentage of your visitors will have Javascript disabled).

Additionally, you could also set a cookie, so that it would remember the preferences of each mobile visitor, and redirect accordingly.

PHP Cookies


Brandon Tanner is offline  
The Following User Says Thank You to Brandon Tanner For This Useful Post:
Unread 26th Nov 2012, 09:36 PM   #3
Active Warrior
 
garfield29's Avatar
 
Join Date: 2012
Posts: 71
Thanks: 42
Thanked 7 Times in 6 Posts
Default
Re: Return to Desktop code
Share on: 
fb share twitter share gplus share more share

Thank you Brandon.

I'm not really good with codes, but I think I'll be able to handle this.
garfield29 is offline  
Unread 27th Nov 2012, 02:08 AM   #4
Active Warrior
 
garfield29's Avatar
 
Join Date: 2012
Posts: 71
Thanks: 42
Thanked 7 Times in 6 Posts
Default
Re: Return to Desktop code
Share on: 
fb share twitter share gplus share more share

I sent a pm, Brandon. Something more about the code you gave me..
garfield29 is offline  
Closed Thread


Bookmarks

Tags
code, desktop, return


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -6. The time now is 03:05 AM.