26th Nov 2012, 03:18 AM | #1 |
Active Warrior Join Date: 2012
Posts: 71
Thanks: 42
Thanked 7 Times in 6 Posts
|
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 |
26th Nov 2012, 08:57 AM | #2 |
Advanced Warrior War Room Member Join Date: 2006 Location: USA
Posts: 1,907
Thanks: 237
Thanked 1,377 Times in 676 Posts
|
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 |
| |
The Following User Says Thank You to Brandon Tanner For This Useful Post: |
26th Nov 2012, 09:36 PM | #3 |
Active Warrior Join Date: 2012
Posts: 71
Thanks: 42
Thanked 7 Times in 6 Posts
|
Thank you Brandon. I'm not really good with codes, but I think I'll be able to handle this. |
27th Nov 2012, 02:08 AM | #4 |
Active Warrior Join Date: 2012
Posts: 71
Thanks: 42
Thanked 7 Times in 6 Posts
|
I sent a pm, Brandon. Something more about the code you gave me..
|
Bookmarks |
Tags |
code, desktop, return |
| |