Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How do I fix a php mobile detect and redirect script to allow users on mobile devices to see the full site

Posted on 2016-09-27
4
Medium Priority
?
182 Views
Last Modified: 2016-11-05
I have this script at the top of my code:

<?php
error_reporting(E_ALL ^ E_NOTICE);
 session_start();
$refering_url = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
//echo $refering_url;
if (strpos($refering_url,'mobile/ab-moving-storage-mobile.html') !== false) {
    //echo 'true';
	$_SESSION['last_url']=$refering_url;
}
else
{
//echo "else condition...";
if($_SESSION['last_url']=="") {
 require_once('mobile_device_detect.php');
mobile_device_detect(true,true,true,true,true,true,true,'http://www.abmoving.com/mobile/ab-moving-storage-mobile.html',false);
}
//$_SESSION['last_url']="";
}

?>

Open in new window


It redirects with no problem, but when "Go to Full Site" is clicked from the mobile version of the page, it will not display the full site version on the mobile device. It redirect to the mobile version

The desktop page: abmoving.com/ab-moving-storage.php
The mobile page: abmoving.com/mobile/abmoving-storage-mobile.html

We are working on a responsive site but I need this in the meantime.
0
Comment
Question by:weknowjack
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 1600 total points
ID: 41819640
you must add a parameter in the "Go to Full Site" link/button.

so you can check if it was a click from it :

$gotoFullSiteClicked = $_GET["gotofull"] == "1"; // check if the parameter gotofull is set to 1

else if($gotoFullSiteClicked)
{
   // go to full site

Open in new window

0
 

Author Comment

by:weknowjack
ID: 41819668
Thank you, but I am not a coder. Where would this parameter be placed? In the non-mobile page?
0
 
LVL 111

Assisted Solution

by:Ray Paseur
Ray Paseur earned 400 total points
ID: 41826559
Been out of town for a few weeks and returned today.  Got a neglected question alert on this one.  Here is my take on the question.

The trend from desktop to mobile "tipped" in 2012.  Nobody uses mobile detection any more.  The assumption today (2016) is that all accesses are coming from mobile first.  This means that we design for mobile, and let desktop be the graceful fallback.  To that end, tools like Twitter Bootstrap are the right way to go.  The interim step of trying to shoehorn an old desktop site into some kind of mobile-friendly structure may not be value-added.  In my experience, it's faster and gets better results, if you just refactor the old site (only once).

Also, you really need a coder to handle this.  It's worth the investment to get it completely right, and the results will likely serve you well for a long time!
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article discusses how to implement server side field validation and display customized error messages to the client.
In this blog, we’ll look at how improvements to Percona XtraDB Cluster improved IST performance.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question