![]() | ![]() | ||||||||
| | #1 |
| Warrior Member Join Date: Jul 2007 Location: , , USA.
Posts: 18
Thanks: 8
Thanked 1 Time in 1 Post
|
Anyone got a working solution for this? I've tried several different mobile detect sripts and redirects and have gotten them all to work. What I need is if I put a link to View Full Site on the mobile page for the user to be able to click that link and go to the full site not once again be redirected back to the mobile version. The closest solution I have been able to find is: PHP Mobile Redirect and View Full Site But even that one doesn't work atleast not for me. I know there's someone out there that knows of a working solution. Thanks, Erick |
| | |
| | #2 |
| HyperActive Warrior Join Date: Mar 2007 Location: , , Canada.
Posts: 258
Thanks: 2
Thanked 44 Times in 39 Posts
|
I use HandHeld from elegantthemes. Once i click on full site, you scroll to the bottom and its shows up a blue line to click back to mobile view. |
| | |
| | #3 |
| Warrior Member Join Date: Mar 2008
Posts: 13
Thanks: 3
Thanked 7 Times in 6 Posts
|
You would just include a variable check before the redirection code and then include it in the link from the mobile site ( eg. http://www.yoursite.com?fs=true ). ND |
| | |
| | #4 | |
| Warrior Member Join Date: Jul 2007 Location: , , USA.
Posts: 18
Thanks: 8
Thanked 1 Time in 1 Post
| Quote:
| |
| | |
| | #5 | |
| You reap what you sow. War Room Member Join Date: May 2008 Location: Mobile
Posts: 814
Thanks: 154
Thanked 326 Times in 197 Posts
| Quote:
If you want a "copy+paste" code, you should try asking in coding forums but even in such forums I don't think you will get an answer. | |
| "...closed a sale while I was testing this tool in the beta testing period..." Mobile Landing Pages |Premium Mobile Website Templates "..amazing!.." "..super fast.." "..best of this style.." | ||
| | |
| | #6 |
| Warrior Member Join Date: Jul 2007 Location: , , USA.
Posts: 18
Thanks: 8
Thanked 1 Time in 1 Post
|
I've currently got this code in my header.php at the very top: <?php @include("Mobile_Detect.php"); $detect = new Mobile_Detect(); if ($detect->isMobile() && isset($_COOKIE['mobile'])) { $detect = "false"; } elseif ($detect->isMobile()) { header("Location:http://m.mobilesite.com"); } ?> I've got the following code in my mobile sites index at the very top: <?php setcookie("mobile","m", time()+3600, "/",".fullsite.com"); ?> I've got the Mobile_Detect.php in my main sites root folder. This is the code I have at the bottom of my mobile pages: <a id="footer-fullsite" href="http://fullsite.com/">Desktop</a>/<a id="footer-fullsite" href="">Mobile</a> Maybe I'm doing something wrong? Another set of eyes never hurts. |
| | |
| | #7 | |
| Advanced Warrior War Room Member Join Date: Jul 2006 Location: USA
Posts: 2,409
Thanks: 157
Thanked 1,029 Times in 462 Posts
| Quote:
So for your mobile visitors who choose to view your full site (and not get stuck in an endless redirect loop)... you first check to see if your cookie has been saved on their device. If so, you use that to set the redirect "flag". If not, then you can set the flag via sessions or via the query string (which of course will only work for as long as they stay on your site, but it's better than nothing). | |
| | ||
| | |
| | #8 |
| ResponsiveDesignTest.Net Registered Member Join Date: Nov 2011 Location: Spain
Posts: 640
Thanks: 64
Thanked 166 Times in 149 Posts
|
I would go with cookies and PHP sessions, too. All those scripts just check the UA, route to the websites and saving preferences can only be done via cookies. If no cookie is saved... |
|
HTML/CSS/jQuery/ZURB Foundation 3/Twitter Bootstrap 2/Wordpress/Frontend Performance Optimizing --- Need HTML/CSS help? Skype: microcosmic - Test Your Responsive Design - InternetCookies.eu | |
| | |
| | #9 |
| Warrior Member Registered Member Join Date: Jan 2013
Posts: 14
Thanks: 0
Thanked 0 Times in 0 Posts
|
If you follow these instructions you will have a functioning mobile redirect on your site: First, go to the following URL and download the mobile_detect.php file: php-mobile-detect - The lightweight PHP class for detecting mobile devices. - Google Project Hosting Next, follow the instructions on the page, and upload the mobile_detect.php to your root directory. Dougbrysun.. |
| | |
| | #10 |
| webstylecreator.com War Room Member Join Date: Jun 2010 Location: Torino, Italy
Posts: 674
Thanks: 58
Thanked 67 Times in 45 Posts
|
This is what I use and it works very well: On the dekstop website: <?php function is_mobile(){ $regex_match="/(nokia|iphone|android|motorola|^mot\-|softbank|foma|docomo|kddi|up\.browser|up\.link|"; $regex_match.="htc|dopod|blazer|netfront|helio|hos in|huawei|novarra|CoolPad|webos|techfaith|palmsour ce|"; $regex_match.="blackberry|alcatel|amoi|ktouch|nexi an|samsung|^sam\-|s[cg]h|^lge|ericsson|philips|sagem|wellcom|bunjalloo|ma ui|"; $regex_match.="symbian|smartphone|midp|wap|phone|w indows ce|iemobile|^spice|^bird|^zte\-|longcos|pantech|gionee|^sie\-|portalmmm|"; $regex_match.="jig\s browser|hiptop|^ucweb|^benq|haier|^lct|opera\s*mob i|opera\*mini|320x320|240x320|176x220"; $regex_match.=")/i"; return isset($_SERVER['HTTP_X_WAP_PROFILE']) or isset($_SERVER['HTTP_PROFILE']) or preg_match($regex_match, strtolower($_SERVER['HTTP_USER_AGENT'])); } switch($_GET['mode']) { case 'mobile': $mode = "mobile"; break; case 'desktop': $mode = "desktop"; break; default: $mode = is_mobile() ? "mobile" : "desktop"; break; } if ($mode == "mobile") { header ("Location: http://www.m.mainsite.com"); return; } ?> On the mobile website: <a href="http://www.mainsite.com/?mode=desktop">Full Site</a> |
| | |
| | |
| | #11 |
| Active Warrior War Room Member Join Date: Feb 2010 Location: Berkeley, CA
Posts: 48
Blog Entries: 1 Thanks: 7
Thanked 13 Times in 13 Posts
|
I found the redirect script from Mobile Web Pro works well for this. But I have it set so only the home page is redirected so if you click "see full site" from your mobile device you can still visit the other pages without being redirected. I created a duplicate home template called "homeR" and this makes it so only the home page redirects. The mobile site has a link that forces the home page to load. PM me and I'll show you the details of how I do it. |
|
Newbies PM me if you need simple answers to simple questions. Don't waste too much time figuring things out (being lost) when all you have to do is ask for directions. TweakingWP.com | |
| | |
| | #12 | |
| HyperActive Warrior War Room Member Join Date: Jul 2002 Location: USA.
Posts: 481
Thanks: 328
Thanked 115 Times in 89 Posts
| Quote:
| |
| | ||
| | |
| | #13 |
| Warrior Member Join Date: Jul 2007 Location: , , USA.
Posts: 18
Thanks: 8
Thanked 1 Time in 1 Post
|
Ok, I finally got it to work. Here's the code: <?php @include("Mobile_Detect.php"); $detect = new Mobile_Detect(); if ($detect->isMobile() && isset($_COOKIE['mobile'])) { $detect = "false"; } elseif ($detect->isMobile()) { header("Location:http://m.mobilesite.com"); } setcookie("mobile","m", time()+3600, "/",".fullsite.com"); ?> I ended up combining the set cookie part which originally was in the index.php with the code that was put in my header.php I put the combind code in my header.php and it is working great. I am also willing to bet that if I was to put that code in my index.php it would work too. I appreciate all the help and suggestions. Thanks!!! |
| | |
| | #14 |
| Warrior Member Join Date: Jul 2007 Location: , , USA.
Posts: 18
Thanks: 8
Thanked 1 Time in 1 Post
|
I should add that this is working with some code I added to the .htaccess
|
| | |
![]() |
|
| Bookmarks |
| Tags |
| detect or redirect, full, mobile, php, site, view |
| Thread Tools | |
| |
![]() |