Warrior Forum - The #1 Digital Marketing Forum & Marketplace

Warrior Forum - The #1 Digital Marketing Forum & Marketplace (https://www.warriorforum.com/)
-   Mobile Marketing (https://www.warriorforum.com/mobile-marketing/)
-   -   Return to Desktop code (https://www.warriorforum.com/mobile-marketing/717345-return-desktop-code.html)

garfield29 26th November 2012 03:18 AM

Return to Desktop code
 
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

Brandon Tanner 26th November 2012 08:57 AM

Re: Return to Desktop code
 
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

garfield29 26th November 2012 09:36 PM

Re: Return to Desktop code
 
Thank you Brandon.

I'm not really good with codes, but I think I'll be able to handle this.
:)

garfield29 27th November 2012 02:08 AM

Re: Return to Desktop code
 
I sent a pm, Brandon. Something more about the code you gave me..


All times are GMT -6. The time now is 02:58 AM.